From: Ben Pfaff Date: Tue, 15 Jun 2010 17:25:21 +0000 (-0700) Subject: vlog: Check that all declared vlog modules are used, at "make" time. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22c79496a9a6d56ce82c73ce2719fecbf028f133;p=openvswitch vlog: Check that all declared vlog modules are used, at "make" time. --- diff --git a/Makefile.am b/Makefile.am index fa7b5ea2..fd6c56cc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -25,6 +25,7 @@ else AM_LDFLAGS = -export-dynamic endif +ALL_LOCAL = BUILT_SOURCES = CLEANFILES = DISTCLEANFILES = @@ -118,6 +119,7 @@ dist-hook-git: DIST_HOOKS += dist-hook-git dist-hook: $(DIST_HOOKS) +all-local: $(ALL_LOCAL) .PHONY: $(DIST_HOOKS) include lib/automake.mk diff --git a/include/openflow/automake.mk b/include/openflow/automake.mk index b8dbc71b..4b370d4f 100644 --- a/include/openflow/automake.mk +++ b/include/openflow/automake.mk @@ -3,14 +3,14 @@ noinst_HEADERS += \ include/openflow/openflow.h if HAVE_PYTHON -all-local: include/openflow/openflow.h.stamp +ALL_LOCAL += include/openflow/openflow.h.stamp include/openflow/openflow.h.stamp: \ include/openflow/openflow.h build-aux/check-structs $(PYTHON) $(srcdir)/build-aux/check-structs $(srcdir)/include/openflow/openflow.h touch $@ DISTCLEANFILES += include/openflow/openflow.h.stamp -all-local: include/openflow/nicira-ext.h.stamp +ALL_LOCAL += include/openflow/nicira-ext.h.stamp include/openflow/nicira-ext.h.stamp: include/openflow/openflow.h include/openflow/nicira-ext.h build-aux/check-structs $(PYTHON) $(srcdir)/build-aux/check-structs $(srcdir)/include/openflow/openflow.h $(srcdir)/include/openflow/nicira-ext.h touch $@ diff --git a/lib/automake.mk b/lib/automake.mk index 5cc4e0fe..a619d228 100644 --- a/lib/automake.mk +++ b/lib/automake.mk @@ -260,3 +260,31 @@ lib/coverage-counters.c: $(COVERAGE_FILES) lib/coverage-scan.pl (cd $(srcdir) && $(PERL) lib/coverage-scan.pl $(COVERAGE_FILES)) > $@.tmp mv $@.tmp $@ EXTRA_DIST += lib/coverage-scan.pl + + +# Make sure that every vlog module listed in vlog-modules.def is +# actually used somewhere. +ALL_LOCAL += check-for-unused-vlog-modules +check-for-unused-vlog-modules: + if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \ + cd $(srcdir); \ + decl_vlog=`sed -n 's/^VLOG_MODULE(\([_a-z0-9]\{1,\}\)).*$$/\1/p' \ + lib/vlog-modules.def | \ + LC_ALL=C sort -u | \ + xargs echo`; \ + used_vlog=`git grep VLM_ | \ + sed -n 's/.*VLM_\([a-z_0-9]\{1,\}\).*/\1/p' | \ + LC_ALL=C sort -u | \ + xargs echo`; \ + rc=0; \ + for decl in $$decl_vlog; do \ + case " $$used_vlog " in \ + *" $$decl "*) ;; \ + *) echo "vlog module $$decl is declared in lib/vlog-modules.def \ +but not used by any source file"; \ + rc=1 ;; \ + esac \ + done; \ + exit $$rc; \ + fi +.PHONY: check-for-unused-vlog-modules