changeset 12816:7a4d2814715b

syntax-check: detect incorrect boolean macro values in config.h * modules/maintainer-makefile (configure.ac): Parameterize the location of config.h which will be available to makefiles as $(CONFIG_INCLUDE). The logic is from Eric Blake and the location indicated by Jim Meyering. Note the more natural CONFIG_HEADER name is prohibited by automake for backwards compatibility reasons. * top/maint.mk (sc_Wundef_boolean): New rule.
author Pádraig Brady <P@draigBrady.com>
date Mon, 25 Jan 2010 10:55:34 +0000
parents 3782e680ac8b
children d30052be2767
files ChangeLog modules/maintainer-makefile top/maint.mk
diffstat 3 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jan 25 12:54:12 2010 +0100
+++ b/ChangeLog	Mon Jan 25 10:55:34 2010 +0000
@@ -1,3 +1,13 @@
+2010-01-25 Pádraig Brady <P@draigBrady.com>
+
+	syntax-check: detect incorrect boolean macro values in config.h
+	* modules/maintainer-makefile (configure.ac): Parameterize the location
+	of config.h which will be available to makefiles as $(CONFIG_INCLUDE).
+	The logic is from Eric Blake and the location indicated by Jim Meyering.
+	Note the more natural CONFIG_HEADER name is prohibited by automake
+	for backwards compatibility reasons.
+	* top/maint.mk (sc_Wundef_boolean): New rule.
+
 2010-01-25  Jim Meyering  <meyering@redhat.com>
 
 	bootstrap: detect MacOS 10.6's shasum, too
--- a/modules/maintainer-makefile	Mon Jan 25 12:54:12 2010 +0100
+++ b/modules/maintainer-makefile	Mon Jan 25 10:55:34 2010 +0000
@@ -9,6 +9,10 @@
 useless-if-before-free
 vc-list-files
 
+configure.ac:
+AC_CONFIG_COMMANDS_PRE([m4_ifdef([AH_HEADER],
+  [AC_SUBST([CONFIG_INCLUDE], m4_defn([AH_HEADER]))])])
+
 License:
 GPLed build tool
 
--- a/top/maint.mk	Mon Jan 25 12:54:12 2010 +0100
+++ b/top/maint.mk	Mon Jan 25 10:55:34 2010 +0000
@@ -718,6 +718,14 @@
 	       exit 1; };						\
 	fi
 
+# #if HAVE_... will evaluate to false for any non numeric string.
+# That would be flagged by using -Wundef, however gnulib currently
+# tests many undefined macros, and so we can't enable that option.
+# So at least preclude common boolean strings as macro values.
+sc_Wundef_boolean:
+	@grep -Ei '^#define.*(yes|no|true|false)$$' '$(CONFIG_INCLUDE)' && \
+	  { echo 'Use 0 or 1 for macro values' 1>&2; exit 1; } || :
+
 vc-diff-check:
 	(unset CDPATH; cd $(srcdir) && $(VC) diff) > vc-diffs || :
 	if test -s vc-diffs; then				\