bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] maint.mk: new syntax check for HAVE_DECL checks


From: Eric Blake
Subject: [PATCH] maint.mk: new syntax check for HAVE_DECL checks
Date: Fri, 13 Jul 2012 14:04:29 -0600

Based on Karel's report, we might as well enforce a syntax check
to help avoid future problems.
https://lists.gnu.org/archive/html/coreutils/2012-06/msg00037.html

* top/maint.mk (sc_prohibit_undefined_have_decl_tests): New rule.
* cfg.mk
(exclude_file_name_regexp--sc_prohibit_undefined_have_decl_tests):
Exempt some false positives.
Based on a report by Karel Zak.
---

Thoughts on whether this is useful?  Should we get rid of the
sanity checks that use #error when a macro is undefined, in order
to reduce the number of exemptions?

 ChangeLog    |    7 +++++++
 cfg.mk       |    3 +++
 top/maint.mk |    5 +++++
 3 files changed, 15 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index f3633d1..dff359b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2012-07-13  Eric Blake  <address@hidden>

+       maint.mk: new syntax check for HAVE_DECL checks
+       * top/maint.mk (sc_prohibit_undefined_have_decl_tests): New rule.
+       * cfg.mk
+       (exclude_file_name_regexp--sc_prohibit_undefined_have_decl_tests):
+       Exempt some false positives.
+       Based on a report by Karel Zak.
+
        argp: make HAVE_DECL usage consistent
        * lib/argp-parse.c (__argp_parse): Check contents of HAVE_DECL
        macros, not whether they are defined.
diff --git a/cfg.mk b/cfg.mk
index 45a321c..5c2ca3c 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -77,3 +77,6 @@ if_before_free_basename_re_ = \

 exclude_file_name_regexp--sc_avoid_if_before_free = \
   ^lib/($(if_before_free_basename_re_))\.c$$
+
+exclude_file_name_regexp--sc_prohibit_undefined_have_decl_tests = \
+  ^lib/((error|getopt|strtoimax)\.c|(fpending|getpass)\.h)$$
diff --git a/top/maint.mk b/top/maint.mk
index 0023989..8c366bd 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -777,6 +777,11 @@ sc_prohibit_always_true_header_tests:
        '  with the corresponding gnulib module, they are always true') \
          $(_sc_search_regexp)

+sc_prohibit_undefined_have_decl_tests:
+       prohibit='#[     ]*if(n?def|.*defined)[  ]*\)?HAVE_DECL_'       \
+       halt='$(ME): HAVE_DECL macros are always defined'               \
+         $(_sc_search_regexp)
+
 # ==================================================================
 gl_other_headers_ ?= \
   intprops.h   \
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]