diff options
author | Jim Meyering <meyering@redhat.com> | 2010-05-03 12:05:14 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2010-05-03 13:24:04 +0200 |
commit | ecf6d16dc7488e6929cd431c31288b354071dce3 (patch) | |
tree | 1ad16d1332ec253c0c303624d3cda64112aa9099 | |
parent | c0e784b92338b26b28c0194b86ff59f23f37eb44 (diff) | |
download | coreutils-ecf6d16dc7488e6929cd431c31288b354071dce3.tar.xz |
maint: extend the always_defined_macros syntax-check
* cfg.mk (gl_generated_headers_): Define.
(headers_with_interesting_macro_defs): Remove headers covered
by the above.
(.re-defmac): Extract symbol names from many more files.
(sc_always_defined_macros): Use VC_LIST_EXCEPT, not VC_LIST, so
that we can use the usual exception mechanism.
Test for $(gnulib_dir), not system.h.
* .x-sc_always_defined_macros: New file. Exempt src/seq.c.
* Makefile.am (syntax_check_exceptions): Add it here.
-rw-r--r-- | .x-sc_always_defined_macros | 1 | ||||
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | cfg.mk | 24 |
3 files changed, 16 insertions, 10 deletions
diff --git a/.x-sc_always_defined_macros b/.x-sc_always_defined_macros new file mode 100644 index 000000000..8c96958a4 --- /dev/null +++ b/.x-sc_always_defined_macros @@ -0,0 +1 @@ +src/seq.c diff --git a/Makefile.am b/Makefile.am index 83c28b336..f1417a466 100644 --- a/Makefile.am +++ b/Makefile.am @@ -41,6 +41,7 @@ changelog_etc = \ syntax_check_exceptions = \ .x-sc_GPL_version \ + .x-sc_always_defined_macros \ .x-sc_error_message_uppercase \ .x-sc_file_system \ .x-sc_obsolete_symbols \ @@ -106,24 +106,28 @@ sc_x_sc_dist_check: ) | sort | uniq -u)" \ && { echo 'Makefile.am: $(sce) mismatch' >&2; exit 1; } || :; +gl_generated_headers_ = \ + $$(cd $(gnulib_dir)/lib && echo *.in.h|sed 's,sys_,sys/,g;s/\.in\.h/.h/g') + headers_with_interesting_macro_defs = \ exit.h \ - fcntl_.h \ - fnmatch_.h \ intprops.h \ - inttypes_.h \ lchown.h \ openat.h \ - stat-macros.h \ - stdint_.h + stat-macros.h + +gl_extract_significant_defines_ = \ + /^\# *define ([^_ (][^ (]*)\s*(\(|\w+)/ && $$2 !~ /(?:rpl_|_used_without_)/ \ + and print $$1 # Create a list of regular expressions matching the names # of macros that are guaranteed by parts of gnulib to be defined. .re-defmac: - @(cd $(srcdir)/lib; \ - for f in $(headers_with_interesting_macro_defs); do \ + @gen_h=$(gl_generated_headers_); \ + (cd $(srcdir)/lib; \ + for f in $(headers_with_interesting_macro_defs) $$gen_h; do \ test -f $$f && \ - sed -n '/^# *define \([^_ (][^ (]*\)[ (].*/s//\1/p' $$f; \ + perl -lne '$(gl_extract_significant_defines_)' $$f; \ done; \ ) | sort -u \ | grep -Ev 'ATTRIBUTE_NORETURN|SIZE_MAX' \ @@ -133,12 +137,12 @@ headers_with_interesting_macro_defs = \ # Don't define macros that we already get from gnulib header files. sc_always_defined_macros: .re-defmac - @if test -f $(srcdir)/src/system.h; then \ + @if test -d $(gnulib_dir); then \ trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0; \ am__exit='(exit $rc); exit $rc'; \ trap "rc=129; $$am__exit" 1; trap "rc=130; $$am__exit" 2; \ trap "rc=131; $$am__exit" 3; trap "rc=143; $$am__exit" 15; \ - grep -f .re-defmac $$($(VC_LIST)) \ + grep -f .re-defmac $$($(VC_LIST_EXCEPT)) \ && { echo '$(ME): define the above via some gnulib .h file' \ 1>&2; exit 1; } || :; \ fi |