bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] maint.mk: enhance useless header checks


From: Eric Blake
Subject: [PATCH] maint.mk: enhance useless header checks
Date: Fri, 24 Jun 2011 15:48:47 -0600

Libvirt was mistakenly using <intprops.h> instead of "intprops.h"
in one place; when I fixed that, I was surprised to get a
syntax-check failure from an unused header.

* top/maint.mk (_sc_header_without_use): Check both include
styles.
(sc_prohibit_assert_without_use)
(sc_prohibit_close_stream_without_use)
(sc_prohibit_getopt_without_use)
(sc_prohibit_quotearg_without_use)
(sc_prohibit_quote_without_use)
(sc_prohibit_long_options_without_use)
(sc_prohibit_inttostr_without_use)
(sc_prohibit_ignore_value_without_use)
(sc_prohibit_error_without_use, sc_prohibit_xalloc_without_use)
(sc_prohibit_hash_without_use, sc_prohibit_cloexec_without_use)
(sc_prohibit_posixver_without_use, sc_prohibit_same_without_use)
(sc_prohibit_hash_pjw_without_use)
(sc_prohibit_safe_read_without_use)
(sc_prohibit_argmatch_without_use)
(sc_prohibit_canonicalize_without_use)
(sc_prohibit_root_dev_ino_without_use)
(sc_prohibit_openat_without_use)
(sc_prohibit_c_ctype_without_use)
(sc_prohibit_signal_without_use)
(sc_prohibit_stdio--_without_use)
(sc_prohibit_stdio-safer_without_use)
(sc_prohibit_strings_without_use)
(sc_prohibit_intprops_without_use)
(sc_prohibit_stddef_without_use)
(sc_prohibit_xfreopen_without_use): Update clients.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog    |   29 ++++++++++++++++++++++++++++
 top/maint.mk |   60 +++++++++++++++++++++++++++++-----------------------------
 2 files changed, 59 insertions(+), 30 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2ce487c..2f4944d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,34 @@
 2011-06-24  Eric Blake  <address@hidden>

+       maint.mk: enhance useless header checks
+       * top/maint.mk (_sc_header_without_use): Check both include
+       styles.
+       (sc_prohibit_assert_without_use)
+       (sc_prohibit_close_stream_without_use)
+       (sc_prohibit_getopt_without_use)
+       (sc_prohibit_quotearg_without_use)
+       (sc_prohibit_quote_without_use)
+       (sc_prohibit_long_options_without_use)
+       (sc_prohibit_inttostr_without_use)
+       (sc_prohibit_ignore_value_without_use)
+       (sc_prohibit_error_without_use, sc_prohibit_xalloc_without_use)
+       (sc_prohibit_hash_without_use, sc_prohibit_cloexec_without_use)
+       (sc_prohibit_posixver_without_use, sc_prohibit_same_without_use)
+       (sc_prohibit_hash_pjw_without_use)
+       (sc_prohibit_safe_read_without_use)
+       (sc_prohibit_argmatch_without_use)
+       (sc_prohibit_canonicalize_without_use)
+       (sc_prohibit_root_dev_ino_without_use)
+       (sc_prohibit_openat_without_use)
+       (sc_prohibit_c_ctype_without_use)
+       (sc_prohibit_signal_without_use)
+       (sc_prohibit_stdio--_without_use)
+       (sc_prohibit_stdio-safer_without_use)
+       (sc_prohibit_strings_without_use)
+       (sc_prohibit_intprops_without_use)
+       (sc_prohibit_stddef_without_use)
+       (sc_prohibit_xfreopen_without_use): Update clients.
+
        maint.mk: update sc_prohibit_intprops_without_use
        * top/maint.mk (_intprops_names): Match recent changes.

diff --git a/top/maint.mk b/top/maint.mk
index ed598e0..e6e03a8 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -405,11 +405,11 @@ sc_prohibit_HAVE_MBRTOWC:
          $(_sc_search_regexp)

 # To use this "command" macro, you must first define two shell variables:
-# h: the header, enclosed in <> or ""
+# h: the header name, with no enclosing <> or ""
 # re: a regular expression that matches IFF something provided by $h is used.
 define _sc_header_without_use
   dummy=; : so we do not need a semicolon before each use;             \
-  h_esc=`echo "$$h"|sed 's/\./\\\\./g'`;                               \
+  h_esc=`echo '[<"]'"$$h"'[">]'|sed 's/\./\\\\./g'`;                   \
   if $(VC_LIST_EXCEPT) | grep -l '\.c$$' > /dev/null; then             \
     files=$$(grep -l '^# *include '"$$h_esc"                           \
             $$($(VC_LIST_EXCEPT) | grep '\.c$$')) &&                   \
@@ -422,42 +422,42 @@ endef

 # Prohibit the inclusion of assert.h without an actual use of assert.
 sc_prohibit_assert_without_use:
-       @h='<assert.h>' re='\<assert *\(' $(_sc_header_without_use)
+       @h='assert.h' re='\<assert *\(' $(_sc_header_without_use)

 # Prohibit the inclusion of close-stream.h without an actual use.
 sc_prohibit_close_stream_without_use:
-       @h='"close-stream.h"' re='\<close_stream *\(' $(_sc_header_without_use)
+       @h='close-stream.h' re='\<close_stream *\(' $(_sc_header_without_use)

 # Prohibit the inclusion of getopt.h without an actual use.
 sc_prohibit_getopt_without_use:
-       @h='<getopt.h>' re='\<getopt(_long)? *\(' $(_sc_header_without_use)
+       @h='getopt.h' re='\<getopt(_long)? *\(' $(_sc_header_without_use)

 # Don't include quotearg.h unless you use one of its functions.
 sc_prohibit_quotearg_without_use:
-       @h='"quotearg.h"' re='\<quotearg(_[^ ]+)? *\(' $(_sc_header_without_use)
+       @h='quotearg.h' re='\<quotearg(_[^ ]+)? *\(' $(_sc_header_without_use)

 # Don't include quote.h unless you use one of its functions.
 sc_prohibit_quote_without_use:
-       @h='"quote.h"' re='\<quote(_n)? *\(' $(_sc_header_without_use)
+       @h='quote.h' re='\<quote(_n)? *\(' $(_sc_header_without_use)

 # Don't include this header unless you use one of its functions.
 sc_prohibit_long_options_without_use:
-       @h='"long-options.h"' re='\<parse_long_options *\(' \
+       @h='long-options.h' re='\<parse_long_options *\(' \
          $(_sc_header_without_use)

 # Don't include this header unless you use one of its functions.
 sc_prohibit_inttostr_without_use:
-       @h='"inttostr.h"' re='\<(off|[iu]max|uint)tostr *\(' \
+       @h='inttostr.h' re='\<(off|[iu]max|uint)tostr *\(' \
          $(_sc_header_without_use)

 # Don't include this header unless you use one of its functions.
 sc_prohibit_ignore_value_without_use:
-       @h='"ignore-value.h"' re='\<ignore_(value|ptr) *\(' \
+       @h='ignore-value.h' re='\<ignore_(value|ptr) *\(' \
          $(_sc_header_without_use)

 # Don't include this header unless you use one of its functions.
 sc_prohibit_error_without_use:
-       @h='"error.h"' \
+       @h='error.h' \
        re='\<error(_at_line|_print_progname|_one_per_line|_message_count)? 
*\('\
          $(_sc_header_without_use)

@@ -480,7 +480,7 @@ sc_prohibit_error_without_use:
 _xa1 = x(((2n?)?re|char|n(re|m)|[cmz])alloc|alloc_(oversized|die)|(mem|str)dup)
 _xa2 = X([CZ]|N?M)ALLOC
 sc_prohibit_xalloc_without_use:
-       @h='"xalloc.h"' \
+       @h='xalloc.h' \
        re='\<($(_xa1)|$(_xa2)) *\('\
          $(_sc_header_without_use)

@@ -491,46 +491,46 @@ 
clear|delete|free|get_(first|next)|insert|lookup|print_statistics|reset_tuning
 _hash_fn = \<($(_hash_re)) *\(
 _hash_struct = (struct )?\<[Hh]ash_(table|tuning)\>
 sc_prohibit_hash_without_use:
-       @h='"hash.h"' \
+       @h='hash.h' \
        re='$(_hash_fn)|$(_hash_struct)'\
          $(_sc_header_without_use)

 sc_prohibit_cloexec_without_use:
-       @h='"cloexec.h"' re='\<(set_cloexec_flag|dup_cloexec) *\(' \
+       @h='cloexec.h' re='\<(set_cloexec_flag|dup_cloexec) *\(' \
          $(_sc_header_without_use)

 sc_prohibit_posixver_without_use:
-       @h='"posixver.h"' re='\<posix2_version *\(' $(_sc_header_without_use)
+       @h='posixver.h' re='\<posix2_version *\(' $(_sc_header_without_use)

 sc_prohibit_same_without_use:
-       @h='"same.h"' re='\<same_name *\(' $(_sc_header_without_use)
+       @h='same.h' re='\<same_name *\(' $(_sc_header_without_use)

 sc_prohibit_hash_pjw_without_use:
-       @h='"hash-pjw.h"' \
+       @h='hash-pjw.h' \
        re='\<hash_pjw *\(' \
          $(_sc_header_without_use)

 sc_prohibit_safe_read_without_use:
-       @h='"safe-read.h"' re='(\<SAFE_READ_ERROR\>|\<safe_read *\()' \
+       @h='safe-read.h' re='(\<SAFE_READ_ERROR\>|\<safe_read *\()' \
          $(_sc_header_without_use)

 sc_prohibit_argmatch_without_use:
-       @h='"argmatch.h"' \
+       @h='argmatch.h' \
        
re='(\<(ARRAY_CARDINALITY|X?ARGMATCH(|_TO_ARGUMENT|_VERIFY))\>|\<argmatch(_exit_fn|_(in)?valid)
 *\()' \
          $(_sc_header_without_use)

 sc_prohibit_canonicalize_without_use:
-       @h='"canonicalize.h"' \
+       @h='canonicalize.h' \
        
re='CAN_(EXISTING|ALL_BUT_LAST|MISSING)|canonicalize_(mode_t|filename_mode)' \
          $(_sc_header_without_use)

 sc_prohibit_root_dev_ino_without_use:
-       @h='"root-dev-ino.h"' \
+       @h='root-dev-ino.h' \
        re='(\<ROOT_DEV_INO_(CHECK|WARN)\>|\<get_root_dev_ino *\()' \
          $(_sc_header_without_use)

 sc_prohibit_openat_without_use:
-       @h='"openat.h"' \
+       @h='openat.h' \
        
re='\<(openat_(permissive|needs_fchdir|(save|restore)_fail)|l?(stat|ch(own|mod))at|(euid)?accessat)\>'
 \
          $(_sc_header_without_use)

@@ -538,7 +538,7 @@ sc_prohibit_openat_without_use:
 ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
 |isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper
 sc_prohibit_c_ctype_without_use:
-       @h='[<"]c-ctype.h[">]' re='\<c_($(ctype_re)) *\(' \
+       @h='c-ctype.h' re='\<c_($(ctype_re)) *\(' \
          $(_sc_header_without_use)

 _empty =
@@ -574,24 +574,24 @@ _sig_syms_re = $(subst $(_sp),|,$(strip $(_sig_names) 
$(_sig_types_and_consts)))

 # Prohibit the inclusion of signal.h without an actual use.
 sc_prohibit_signal_without_use:
-       @h='<signal.h>'                                                 \
+       @h='signal.h'                                                   \
        re='\<($(_sig_function_re)) *\(|\<($(_sig_syms_re))\>'          \
          $(_sc_header_without_use)

 # Don't include stdio--.h unless you use one of its functions.
 sc_prohibit_stdio--_without_use:
-       @h='"stdio--.h"' re='\<((f(re)?|p)open|tmpfile) *\('    \
+       @h='stdio--.h' re='\<((f(re)?|p)open|tmpfile) *\('              \
          $(_sc_header_without_use)

 # Don't include stdio-safer.h unless you use one of its functions.
 sc_prohibit_stdio-safer_without_use:
-       @h='"stdio-safer.h"' re='\<((f(re)?|p)open|tmpfile)_safer *\('  \
+       @h='stdio-safer.h' re='\<((f(re)?|p)open|tmpfile)_safer *\('    \
          $(_sc_header_without_use)

 # Prohibit the inclusion of strings.h without a sensible use.
 # Using the likes of bcmp, bcopy, bzero, index or rindex is not sensible.
 sc_prohibit_strings_without_use:
-       @h='<strings.h>'                                                \
+       @h='strings.h'                                                  \
        re='\<(strn?casecmp|ffs(ll)?)\>'                                \
          $(_sc_header_without_use)

@@ -610,20 +610,20 @@ _intprops_names =                                         
        \
 _intprops_syms_re = $(subst $(_sp),|,$(strip $(_intprops_names)))
 # Prohibit the inclusion of intprops.h without an actual use.
 sc_prohibit_intprops_without_use:
-       @h='"intprops.h"'                                               \
+       @h='intprops.h'                                                 \
        re='\<($(_intprops_syms_re)) *\('                               \
          $(_sc_header_without_use)

 _stddef_syms_re = NULL|offsetof|ptrdiff_t|size_t|wchar_t
 # Prohibit the inclusion of stddef.h without an actual use.
 sc_prohibit_stddef_without_use:
-       @h='<stddef.h>'                                                 \
+       @h='stddef.h'                                                   \
        re='\<($(_stddef_syms_re)) *\('                                 \
          $(_sc_header_without_use)

 # Don't include xfreopen.h unless you use one of its functions.
 sc_prohibit_xfreopen_without_use:
-       @h='"xfreopen.h"' re='\<xfreopen *\(' $(_sc_header_without_use)
+       @h='xfreopen.h' re='\<xfreopen *\(' $(_sc_header_without_use)

 sc_obsolete_symbols:
        @prohibit='\<(HAVE''_FCNTL_H|O''_NDELAY)\>'                     \
-- 
1.7.4.4




reply via email to

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