forked from openvswitch/ovs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vlog: Make the vlog module catalog program-specific.
Until now, the collection of vlog modules supported by a given OVS program was not specific to that program. That means that, for example, even though ovs-dpctl does not have anything to do with jsonrpc, it still has a vlog module for it. This is confusing, at best. This commit fixes the problem on some systems, in particular on ones that use GCC and the GNU linker. It uses the feature of the GNU linker described in its manual as: If an orphaned section's name is representable as a C identifier then the linker will automatically see PROVIDE two symbols: __start_SECNAME and __end_SECNAME, where SECNAME is the name of the section. These indicate the start address and end address of the orphaned section respectively. Systems that don't support these features retain the earlier behavior. This commit also fixes the annoyance that modifying lib/vlog-modules.def causes all sources files that #include "vlog.h" to recompile.
- Loading branch information
Showing
16 changed files
with
292 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#! /bin/sh | ||
|
||
if test "$1" = --help; then | ||
cat <<EOF | ||
$0: cross-check declared and defined vlog modules | ||
usage: $0 [--help] | ||
Must be run from the top-level source directory. | ||
On systems that don't support user-defined section names, the 'vlog' | ||
logging subsystem requires the list of modules in lib/vlog-modules.def | ||
to match the set of vlog modules actually used by the source files. | ||
However, most Open vSwitch development happens on systems that do | ||
support user-defined section names and don't have this requirement. | ||
This utility runs automatically at build time to check this | ||
requirement "by hand", so that Open vSwitch developers don't | ||
accidentally break the build for others. | ||
EOF | ||
exit 0 | ||
elif test "$#" != 0; then | ||
echo "no arguments accepted (use --help for help)" | ||
exit 1 | ||
elif test ! -e lib/vlog-modules.def; then | ||
echo "must run from the top-level source directory (use --help for help)" | ||
exit 1 | ||
fi | ||
|
||
# We can only get a list of source files if this is a Git checkout. | ||
if test -e .git && (git --version) >/dev/null 2>&1; then | ||
: | ||
else | ||
exit 0 | ||
fi | ||
|
||
# Get the list of modules declared in lib/vlog-modules.def. | ||
vlog_modules=` | ||
sed -n 's/^VLOG_MODULE(\([_a-zA-Z0-9]\{1,\}\)).*$/\1/p' \ | ||
lib/vlog-modules.def \ | ||
| LC_ALL=C sort -u | xargs echo` | ||
|
||
# Get the list of modules defined in some source file. | ||
src_modules=` | ||
git grep -h -E '^[ ]*VLOG_DEFINE(_THIS)?_MODULE\([_a-zA-Z0-9]+\)[ ]*$' \ | ||
| sed 's/.*(\([_a-zA-Z0-9]\{1,\}\)).*/\1/' \ | ||
| LC_ALL=C sort -u \ | ||
| xargs echo` | ||
|
||
rc=0 | ||
|
||
for module in $vlog_modules; do | ||
case " $src_modules " in | ||
*" $module "*) ;; | ||
*) echo "vlog module $module is declared in lib/vlog-modules.def but not defined by any source file"; | ||
rc=1 ;; | ||
esac | ||
done | ||
|
||
for module in $src_modules; do | ||
case " $vlog_modules " in | ||
*" $module "*) ;; | ||
*) echo "vlog module $module is defined in a source file but not declared in lib/vlog-modules.def"; | ||
rc=1 ;; | ||
esac | ||
done | ||
|
||
exit $rc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.