From 8b4add2c64d10b260c21352768e22d41dc9d2ff7 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 27 May 2010 13:33:04 +0200 Subject: [PATCH] maint.mk: also prohibit "#undef" of always-defined symbols * top/maint.mk (def_sym_regex): Handle #undef as well as #define. Allow more than one space before the symbol name. (sc_prohibit_always-defined_macros): Use grep's -E, now that the regexp uses alternation. --- ChangeLog | 8 ++++++++ top/maint.mk | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1ee957599e..6a54e630b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-05-27 Jim Meyering + + maint.mk: also prohibit "#undef" of always-defined symbols + * top/maint.mk (def_sym_regex): Handle #undef as well as #define. + Allow more than one space before the symbol name. + (sc_prohibit_always-defined_macros): Use grep's -E, now that + the regexp uses alternation. + 2010-05-26 Eric Blake maint.mk: avoid echo -e diff --git a/top/maint.mk b/top/maint.mk index 045537f8ac..644fbb6485 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -689,7 +689,8 @@ define def_sym_regex perl -lne '$(gl_extract_significant_defines_)' $$f; \ done; \ ) | sort -u \ - | sed 's/^/^ *# *define /;s/$$/\\>/' + | grep -Ev '^ATTRIBUTE_NORETURN' \ + | sed 's/^/^ *# *(define|undef) */;s/$$/\\>/' endef # Don't define macros that we already get from gnulib header files. @@ -698,7 +699,7 @@ sc_prohibit_always-defined_macros: case $$(echo all: | grep -l -f - Makefile) in Makefile);; *) \ echo '$(ME): skipping $@: you lack GNU grep' 1>&2; exit 0;; \ esac; \ - $(def_sym_regex) | grep -f - $$($(VC_LIST_EXCEPT)) \ + $(def_sym_regex) | grep -E -f - $$($(VC_LIST_EXCEPT)) \ && { echo '$(ME): define the above via some gnulib .h file' \ 1>&2; exit 1; } || :; \ fi -- 2.30.2