Mercurial > hg > octave-kai > gnulib-hg
changeset 13275:2917aab6182c
maint.mk: syntax-check: prohibit HAVE_<header>_H that are always true
Derive the list of guaranteed header names from gnulib/lib/*.in.h,
and use that to create a regexp used to detect all #if HAVE_..._H uses.
* top/maint.mk (sc_prohibit_always_true_header_tests): New rule.
(gl_assured_headers_, az_, AZ_): Define.
(gl_header_upper_case_or_, gl_have_header_regex_): Define.
author | Jim Meyering <meyering@redhat.com> |
---|---|
date | Fri, 09 Apr 2010 19:07:57 +0200 |
parents | d87472cc6eec |
children | 4c9bf78586ca |
files | ChangeLog top/maint.mk |
diffstat | 2 files changed, 31 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-04-27 Jim Meyering <meyering@redhat.com> + + maint.mk: syntax-check: prohibit HAVE_<header>_H that are always true + Derive the list of guaranteed header names from gnulib/lib/*.in.h, + and use that to create a regexp used to detect all #if HAVE_..._H uses. + * top/maint.mk (sc_prohibit_always_true_header_tests): New rule. + (gl_assured_headers_, az_, AZ_): Define. + (gl_header_upper_case_or_, gl_have_header_regex_): Define. + 2010-04-26 Jim Meyering <jim@meyering.net> Bruno Haible <bruno@clisp.org>
--- a/top/maint.mk +++ b/top/maint.mk @@ -645,6 +645,28 @@ halt='found useless parentheses in cpp directive' \ $(_sc_search_regexp) +# List headers for which HAVE_HEADER_H is always true, assuming you are +# using the appropriate gnulib module. CAUTION: for each "unnecessary" +# #if HAVE_HEADER_H that you remove, be sure that your project explicitly +# requires the gnulib module that guarantees the usability of that header. +gl_assured_headers_ := \ + $(shell cd $(gnulib_dir)/lib && ls -1 *.in.h|sed 's/\.in\.h$$/ \\/') + +# Convert the list of names to upper case, and replace each space with "|". +az_ = abcdefghijklmnopqrstuvwxyz +AZ_ = ABCDEFGHIJKLMNOPQRSTUVWXYZ +gl_header_upper_case_or_ := \ + $(shell echo $(gl_assured_headers_) \ + | tr $(az_)/.- $(AZ_)___ \ + | tr -s ' ' '|' \ + ) +gl_have_header_regex_ = HAVE_($(gl_header_upper_case_or_))_H +sc_prohibit_always_true_header_tests: + @prohibit='\<$(gl_have_header_regex_)\>' \ + halt='do not test the above HAVE_<header>_H symbol(s);\n'\ +' with the corresponding gnulib module, they are always true' \ + $(_sc_search_regexp) + # Prohibit checked in backup files. sc_prohibit_backup_files: @$(VC_LIST) | grep '~$$' && \