summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-10-14 12:17:24 +0000
committerJim Meyering <jim@meyering.net>2006-10-14 12:17:24 +0000
commit443d5095786055328de8ede2648b9331405de083 (patch)
treec65d9f2fcac025aedc0b42f7ae5a7c6117ae7871
parente0b2cb892ac70029a2d72e6c7812ff35e91b1e64 (diff)
downloadcoreutils-443d5095786055328de8ede2648b9331405de083.tar.xz
* Makefile.maint (headers_with_interesting_macro_defs): Define.
(.re-defmac, sc_always_defined_macros): New rules.
-rw-r--r--ChangeLog3
-rw-r--r--Makefile.maint34
2 files changed, 37 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index fea785c6a..f38ba5124 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2006-10-14 Jim Meyering <jim@meyering.net>
+ * Makefile.maint (headers_with_interesting_macro_defs): Define.
+ (.re-defmac, sc_always_defined_macros): New rules.
+
* src/system.h (EXIT_FAILURE, EXIT_SUCCESS): Remove definitions.
Instead, include "exit.h". This hereby retires the work-around for
"Sony NEWS-OS Release 4.0C"'s bug due to "#define EXIT_FAILURE 0".
diff --git a/Makefile.maint b/Makefile.maint
index 8d12b9eee..528c4e70f 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -219,6 +219,40 @@ sc_root_tests:
&& { echo 'tests/Makefile.am: missing check-root action'>&2; \
exit 1; } || :
+headers_with_interesting_macro_defs = \
+ exit.h \
+ fcntl_.h \
+ fnmatch_.h \
+ intprops.h \
+ inttypes_.h \
+ lchown.h \
+ openat.h \
+ stat-macros.h \
+ stdint_.h
+
+# 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 \
+ test -f $$f && \
+ sed -n '/^# *define \([^_ (][^ (]*\)[ (].*/s//\1/p' $$f; \
+ done; \
+ ) | sort -u \
+ | grep -Ev 'ATTRIBUTE_NORETURN|SIZE_MAX' \
+ | sed 's/^/^# *define /' \
+ > $@-t
+ @mv $@-t $@
+
+# 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 \
+ trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0 1 2 3 15; \
+ grep -f .re-defmac $$($(CVS_LIST)) \
+ && { echo '$(ME): define the above via some gnulib .h file' \
+ 1>&2; exit 1; } || :; \
+ fi
+
# Create a list of regular expressions matching the names
# of files included from system.h. Exclude a couple.
.re-list: