[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#6087: maint: extend the always_defined_macros syntax-check
From: |
Jim Meyering |
Subject: |
bug#6087: maint: extend the always_defined_macros syntax-check |
Date: |
Mon, 03 May 2010 15:55:04 +0200 |
Jim Meyering wrote:
> Three files in coreutils defined WIFSIGNALED and WTERMSIG macros
> to accommodate systems that lack them. However, now that gnulib's
> sys/wait.h guarantees those, there's no point. I've removed them.
>
> maint: remove now-redundant definitions provided by sys/wait.h
> * src/timeout.c (WIFSIGNALED, WTERMSIG): Remove definitions,
> now that gnulib guarantees they are defined in <sys/wait.h>.
> * src/operand2sig.c: Likewise.
> * src/kill.c: Likewise.
>
> As usual, I want to ensure no regressions and remembered
> my always_defined_macros check (currently in coreutils' cfg.mk).
>
> I've extended that check to use not just its few listed .h files,
> but all 50+ that are now generated by gnulib. The result uncovered
> some now-useless signal.h-provided macros, too. I removed those in
> the next change set:
>
> maint: remove now-redundant definitions provided by signal.h
> * src/dd.c (SA_NODEFER, SA_RESETHAND): Remove definitions,
> now that gnulib guarantees they are defined in <signal.h>.
> * src/ls.c (SA_RESTART): Likewise.
>
> Finally, the 3rd change-set does this:
>
> 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.
> * .x-sc_always_defined_macros: New file. Exempt src/seq.c.
> * Makefile.am (syntax_check_exceptions): Add it here.
>
> I'll probably migrate this rule to gnulib after generalizing it some
> more (e.g., removing the system.h check).
I've pushed those changes to coreutils (slightly tweaked), along
with one more:
>From 7d501cdd9c1b7c37dd0c3c085c05969edd2917ee Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 3 May 2010 15:35:56 +0200
Subject: [PATCH] maint: factor trap-related code out of two syntax-check rules
* cfg.mk (gl_trap_): Define, using a loop and eval'd trap,
rather than repeated "trap" uses. Also handle "13", SIGPIPE.
(sc_always_defined_macros): Use it.
(sc_system_h_headers): Likewise.
---
cfg.mk | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 3bdf28c..679ea8e 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -135,13 +135,18 @@ gl_extract_significant_defines_ = \
> address@hidden
@mv address@hidden $@
+define gl_trap_
+ Exit () { set +e; (exit $$1); exit $$1; }; \
+ for sig in 1 2 3 13 15; do \
+ eval "trap 'Exit $$(expr $$sig + 128)' $$sig"; \
+ done
+endef
+
# Don't define macros that we already get from gnulib header files.
sc_always_defined_macros: .re-defmac
@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; \
+ $(gl_trap_); \
grep -f .re-defmac $$($(VC_LIST_EXCEPT)) \
&& { echo '$(ME): define the above via some gnulib .h file' \
1>&2; exit 1; } || :; \
@@ -161,9 +166,7 @@ sc_always_defined_macros: .re-defmac
sc_system_h_headers: .re-list
@if test -f $(srcdir)/src/system.h; then \
trap 'rc=$$?; rm -f .re-list; 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; \
+ $(gl_trap_); \
grep -nE -f .re-list \
$$($(VC_LIST_EXCEPT) | grep '^src/') \
&& { echo '$(ME): the above are already included via system.h'\
--
1.7.1.335.g6845a