>From 0e9eb78c012655bc9f4e9deb12d574bed52f898c Mon Sep 17 00:00:00 2001 From: =?utf-8?q?P=C3=A1draig=20Brady?= Date: Mon, 25 Jan 2010 10:55:34 +0000 Subject: [PATCH] syntax-check: detect incorrect boolean macro values in config.h * modules/maintainer-makefile (configure.ac): Parameterize the location of config.h. The logic is from Eric Blake and the location indicated by Jim Meyering. Note CONFIG_HEADER is a forbidden variable name. * top/maint.mk (sc_Wundef_boolean): New rule. --- ChangeLog | 8 ++++++++ modules/maintainer-makefile | 4 ++++ top/maint.mk | 8 ++++++++ 3 files changed, 20 insertions(+), 0 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9546514..ad563d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-01-25 Pádraig Brady + + syntax-check: detect incorrect boolean macro values in config.h + * modules/maintainer-makefile (configure.ac): Parameterize the location + of config.h. The logic is from Eric Blake and the location indicated + by Jim Meyering. Note CONFIG_HEADER is a forbidden variable name. + * top/maint.mk (sc_Wundef_boolean): New rule. + 2010-01-24 Bruno Haible Tests for module 'yn'. diff --git a/modules/maintainer-makefile b/modules/maintainer-makefile index 21c2802..ed43e87 100644 --- a/modules/maintainer-makefile +++ b/modules/maintainer-makefile @@ -9,6 +9,10 @@ gnumakefile 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 diff --git a/top/maint.mk b/top/maint.mk index 346d681..d384ca6 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -718,6 +718,14 @@ sc_copyright_check: 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 \ -- 1.6.2.5