[m-rev.] diff: fix 0.11 branch

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Dec 30 17:14:03 AEDT 2003


Estimated hours taken: 1
Branches: release

Apply Zoltan's 2003/04/08 main branch patch to the release branch:

Fix spurious failures of namespace cleanliness on aral, which has gcc 3.2
installed. These are caused by the fact that gcc 3.2 apparently has no way
to get gcc -E -dN to not include builtin macros and command line arguments
in its output.

Mmake.common.in:
	Modify the rule for checking namespace cleanliness to check
	not the set of macros defined in the program under test, but the
	set of macros defined in the program under test that aren't also
	defined by an empty program. (The macros defined by an empty
	program are namespace pollution, but they aren't *our* pollution;
	they are the C compiler's.)

runtime/RESERVED_MACRO_NAMES:
	Add some macros that mgnuc causes gcc to define that aren't
	defined by gcc by default.

Workspace: /home/jupiter/fjh/ws-jupiter-0.11/mercury
Index: Mmake.common.in
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmake.common.in,v
retrieving revision 1.68.2.2
diff -u -d -r1.68.2.2 Mmake.common.in
--- Mmake.common.in	19 May 2003 01:39:28 -0000	1.68.2.2
+++ Mmake.common.in	30 Dec 2003 05:32:27 -0000
@@ -346,12 +346,16 @@
 AWK = awk
 
 %.check.macros: %.h %.check_hdr.c
+	@> $*.empty.c
+	- at CC@ -E $*.empty.c -nostdinc -dN 2> /dev/null | \
+		$(AWK) '/[ \t]*#define/ { print $$2; }' | sort -u > $*.base
 	-$(MGNUC) $(ALL_GRADEFLAGS) $(ALL_MGNUCFLAGS) \
 		-DMERCURY_BOOTSTRAP_H -DMR_NO_CONF_BACKWARDS_COMPAT \
-		-E $*.check_hdr.c \
-		-nostdinc -dN \
+		-E $*.check_hdr.c -nostdinc -dN \
 		2> /dev/null | $(AWK) '/[ \t]*#define/ { print $$2; }' | \
-		$(HEADER_CLEAN_FILTER) | sort -u > $@
+		$(HEADER_CLEAN_FILTER) | sort -u > $*.actual
+	@comm -1 -3 $*.base $*.actual > $@
+	@rm $*.base $*.actual
 	@if cmp -s /dev/null $@; then \
 		true; \
 	else \
@@ -362,14 +366,18 @@
 	fi
 
 %.check.mmacros: %.mh %.check_mhdr.c
+	@> $*.mempty.c
+	- at CC@ -E $*.mempty.c -nostdinc -dN 2> /dev/null | \
+		$(AWK) '/[ \t]*#define/ { print $$2; }' | sort -u > $*.mbase
 	-$(MGNUC) $(ALL_GRADEFLAGS) $(ALL_MGNUCFLAGS) \
 		-DMERCURY_BOOTSTRAP_H -DMR_NO_CONF_BACKWARDS_COMPAT \
-		-E $*.check_mhdr.c \
-		-nostdinc -dN \
+		-E $*.check_mhdr.c -nostdinc -dN \
 		2> /dev/null | $(AWK) '/[ \t]*#define/ { print $$2; }' | \
 		grep -v -e `echo $(subst .check.mmacros,,$@) | tr '[a-z]' '[A-Z]'`_H | \
 		grep -v -e `echo $(subst .check.mmacros,,$@) | tr '[a-z]' '[A-Z]'`_DECL_GUARD | \
-		$(HEADER_CLEAN_FILTER) | sort -u > $@
+		$(HEADER_CLEAN_FILTER) | sort -u > $*.mactual
+	@comm -1 -3 $*.mbase $*.mactual > $@
+	@rm $*.mbase $*.mactual
 	@if cmp -s /dev/null $@; then \
 		true; \
 	else \
Index: runtime/RESERVED_MACRO_NAMES
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/RESERVED_MACRO_NAMES,v
retrieving revision 1.14
diff -u -d -r1.14 RESERVED_MACRO_NAMES
--- runtime/RESERVED_MACRO_NAMES	27 Sep 2002 08:51:44 -0000	1.14
+++ runtime/RESERVED_MACRO_NAMES	29 Dec 2003 23:09:25 -0000
@@ -1,5 +1,5 @@
 #-----------------------------------------------------------------------------#
-# Copyright (C) 2000-2002 The University of Melbourne.
+# Copyright (C) 2000-2003 The University of Melbourne.
 # This file may only be copied under the terms of the GNU General
 # Public License - see the file COPYING in the Mercury distribution.
 #-----------------------------------------------------------------------------#
@@ -47,3 +47,19 @@
 # Neither really pollutes the namespace.
 __KERNEL__
 sigcontext_struct
+#-----------------------------------------------------------------------------#
+# This is defined by the mgnuc script in some grades.
+# It is used for configuring the Boehm collector.
+# XXX it should have a GC_ prefix.
+NO_SIGNALS
+#-----------------------------------------------------------------------------#
+# These are defined automatically by GCC -- gcc optionally passes
+# them on the command line when calling cc1, depending on the
+# exact options which gcc was invoked with.  These are not
+# namespace polution, since they are in the _[A-Z]* namespace
+# which is reserved for the C implementation, and they are being
+# defined by the C implementation.
+_GNU_SOURCE
+__EXTENSIONS__
+__OPTIMIZE__
+#-----------------------------------------------------------------------------#

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list