#! /bin/sh if test "$1" = --help; then cat </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