On Fri, Dec 30, 2016 at 9:47 AM, Jim Meyering <[email protected]> wrote:
> Because grep now uses only symbols from intprops.h that have been
> added relatively recently, the hard-coded (out of date) list of
> symbols in the maint.mk rule caused the
> sc_prohibit_intprops_without_use to trigger erroneously.
>
> This updates the list in gnulib.
> I'll update grep's gnulib submodule separately.
>
> I may remove the hard-coded list altogether in this case, but there
> are many similar tests, and not all are as straightforward.

At least this one was doable. I've eliminated that hard-coded list
with the attached:
From 1894933d68f985605a2822af8e9b84b3da3a56fc Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Fri, 30 Dec 2016 09:01:05 -0800
Subject: [PATCH] maint.mk: improve sc_prohibit_intprops_without_use

* top/maint.mk (_intprops_names): Don't hard-code the list of
symbol names.  Instead, derive it on the fly.
---
 ChangeLog    |  6 ++++++
 top/maint.mk | 20 ++++++++------------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6dfa3c7..eb5867f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-12-30  Jim Meyering  <[email protected]>
+
+       maint.mk: improve sc_prohibit_intprops_without_use
+       * top/maint.mk (_intprops_names): Don't hard-code the list of
+       symbol names.  Instead, derive it on the fly.
+
 2016-12-30  Paul Eggert  <[email protected]>

        dfa: shorten sbit, success
diff --git a/top/maint.mk b/top/maint.mk
index 53a1e69..6eb9361 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -657,18 +657,14 @@ sc_prohibit_strings_without_use:
        re='\<(strn?casecmp|ffs(ll)?)\>'                                \
          $(_sc_header_without_use)

-# Get the list of symbol names with this:
-# perl -lne '/^# *define ([A-Z]\w+)\(/ and print $1' lib/intprops.h|fmt
-_intprops_names =                                                      \
-  TYPE_IS_INTEGER TYPE_SIGNED EXPR_SIGNED TYPE_WIDTH TYPE_MINIMUM      \
-  TYPE_MAXIMUM INT_BITS_STRLEN_BOUND INT_STRLEN_BOUND INT_BUFSIZE_BOUND        
\
-  INT_ADD_RANGE_OVERFLOW INT_SUBTRACT_RANGE_OVERFLOW                   \
-  INT_NEGATE_RANGE_OVERFLOW INT_MULTIPLY_RANGE_OVERFLOW                        
\
-  INT_DIVIDE_RANGE_OVERFLOW INT_REMAINDER_RANGE_OVERFLOW               \
-  INT_LEFT_SHIFT_RANGE_OVERFLOW INT_ADD_OVERFLOW INT_SUBTRACT_OVERFLOW \
-  INT_NEGATE_OVERFLOW INT_NEGATE_OVERFLOW INT_MULTIPLY_OVERFLOW                
\
-  INT_DIVIDE_OVERFLOW INT_REMAINDER_OVERFLOW INT_LEFT_SHIFT_OVERFLOW   \
-  INT_ADD_WRAPV INT_SUBTRACT_WRAPV INT_MULTIPLY_WRAPV
+# Extract the raw list of symbol names with this:
+gl_extract_define_simple = \
+  /^\# *define ([A-Z]\w+)\(/ and print $$1
+# Filter out duplicates and convert to a space-separated list:
+_intprops_names := \
+  $(shell f=$(gnulib_dir)/lib/intprops.h;                              \
+    perl -lne '$(gl_extract_define_simple)' $$f | sort -u | tr '\n' ' ')
+# Remove trailing space and convert to a regular expression:
 _intprops_syms_re = $(subst $(_sp),|,$(strip $(_intprops_names)))
 # Prohibit the inclusion of intprops.h without an actual use.
 sc_prohibit_intprops_without_use:
-- 
2.8.0-rc2

Reply via email to