[m-rev.] diff: fix 0.11 branch

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


On 30-Dec-2003, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> Apply Zoltan's 2003/04/08 main branch patch to the release branch:

... and another one.

Estimated hours taken: 1
Branches: release

Apply Zoltan's 2003/05/20 main branch patch to the release branch:

Fix several bugs in namespace cleanliness. These caused error messages, but
they were generated by the shell, not make, and thus didn't have the ** prefix,
which meant they were only spotten when someone happened to really look at
the relevant part of bootcheck output.

tools/bootcheck:
	Link *all* the RESERVED_MACRO_NAMES files into the stage2 directory,
	not just the one in runtime. Without this, all the namespace tests
	silently failed everywhere except in the runtime directory.

browser/RESERVED_MACRO_NAMES:
library/RESERVED_MACRO_NAMES:
	Add the macros defined by gcc and/or mgnuc to the permitted list,
	as was done for runtime/RESERVED_MACRO_NAMES a while ago.

trace/RESERVED_MACRO_NAMES:
	Add this file, which is a copy of the one in runtime, minus a macro
	that shouldn't be defined here. Without this file, one can't test
	namespace cleanliness of the trace directory even in stage 1.

library/io.m:
	Fix a namespace problem by adding an ML_ prefix.

Workspace: /home/jupiter/fjh/ws-jupiter-0.11/mercury
Index: browser/RESERVED_MACRO_NAMES
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/RESERVED_MACRO_NAMES,v
retrieving revision 1.1
diff -u -d -r1.1 RESERVED_MACRO_NAMES
--- browser/RESERVED_MACRO_NAMES	24 Sep 2002 06:55:04 -0000	1.1
+++ browser/RESERVED_MACRO_NAMES	30 Dec 2003 05:41:00 -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.
 #-----------------------------------------------------------------------------#
@@ -36,4 +36,20 @@
 # Normally it would be better to use uppercase for header guard macro names,
 # but that would be inconsistent with the coding style used in mps_gc/code.
 mercury_mps_h
+#-----------------------------------------------------------------------------#
+# 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__
+__STRICT_ANSI__
 #-----------------------------------------------------------------------------#
Index: library/RESERVED_MACRO_NAMES
===================================================================
RCS file: /home/mercury1/repository/mercury/library/RESERVED_MACRO_NAMES,v
retrieving revision 1.1
diff -u -d -r1.1 RESERVED_MACRO_NAMES
--- library/RESERVED_MACRO_NAMES	24 Sep 2002 06:55:15 -0000	1.1
+++ library/RESERVED_MACRO_NAMES	30 Dec 2003 05:40: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.
 #-----------------------------------------------------------------------------#
@@ -37,3 +37,30 @@
 # but that would be inconsistent with the coding style used in mps_gc/code.
 mercury_mps_h
 #-----------------------------------------------------------------------------#
+# 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__
+__STRICT_ANSI__
+#-----------------------------------------------------------------------------#
+# These are defined in exception.m. They are used to map this set of six
+# names, one for each declared mode of builtin.catch/3, down to the three
+# functions that actually implement them (the modes for a given code model
+# have identical implementations). The initial mercury__ prefix puts these
+# macros into name space reserved for Mercury anyway.
+mercury__exception__builtin_catch_3_p_0
+mercury__exception__builtin_catch_3_p_1
+mercury__exception__builtin_catch_3_p_2
+mercury__exception__builtin_catch_3_p_3
+mercury__exception__builtin_catch_3_p_4
+mercury__exception__builtin_catch_3_p_5
Index: library/io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.276.2.3
diff -u -d -r1.276.2.3 io.m
--- library/io.m	1 Apr 2003 04:44:15 -0000	1.276.2.3
+++ library/io.m	30 Dec 2003 05:43:57 -0000
@@ -5843,7 +5843,7 @@
 	#include <sys/stat.h>
 	#include <fcntl.h>
 
-	#define	MAX_TEMPNAME_TRIES	(6 * 4)
+	#define	ML_MAX_TEMPNAME_TRIES	(6 * 4)
 
 	extern long ML_io_tempnam_counter;
 ").
@@ -5889,7 +5889,7 @@
 		num_tries++;
 		ML_io_tempnam_counter += (1 << num_tries);
 	} while (fd == -1 && errno == EEXIST &&
-		num_tries < MAX_TEMPNAME_TRIES);
+		num_tries < ML_MAX_TEMPNAME_TRIES);
 	if (fd == -1) {
 		ML_maybe_make_err_msg(MR_TRUE, ""error opening temporary file: "",
 			MR_PROC_LABEL, ErrorMessage);
Index: tools/bootcheck
===================================================================
RCS file: /home/mercury1/repository/mercury/tools/bootcheck,v
retrieving revision 1.142.2.1
diff -u -d -r1.142.2.1 bootcheck
--- tools/bootcheck	18 Nov 2002 11:05:27 -0000	1.142.2.1
+++ tools/bootcheck	30 Dec 2003 05:45:02 -0000
@@ -488,12 +488,14 @@
 		$LN $root/library/library_strong_name.sn .
 		cp $root/library/Mmake* $root/library/Mercury.options .
 		$LN_S $root/library/$STD_LIB_NAME.init .
+		$LN_S $root/library/RESERVED_MACRO_NAMES .
 		cd $root/stage2
 		mkdir browser
 		cd browser
 		$LN_S $root/browser/*.m .
 		cp $root/browser/Mmake* $root/browser/Mercury.options .
 		$LN_S $root/browser/$BROWSER_LIB_NAME.init .
+		$LN_S $root/browser/RESERVED_MACRO_NAMES .
 		cd $root/stage2
 		if $copy_runtime
 		then
@@ -524,6 +526,7 @@
 			$LN_S $root/trace/*.h .
 			$LN_S $root/trace/*.c .
 			cp $root/trace/Mmake* .
+			$LN_S $root/trace/RESERVED_MACRO_NAMES .
 			cd $root/stage2
 		else
 			$LN_S $root/runtime .
Index: trace/RESERVED_MACRO_NAMES
===================================================================
RCS file: trace/RESERVED_MACRO_NAMES
diff -N trace/RESERVED_MACRO_NAMES
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ trace/RESERVED_MACRO_NAMES	30 Dec 2003 05:42:23 -0000
@@ -0,0 +1,60 @@
+#-----------------------------------------------------------------------------#
+# 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.
+#-----------------------------------------------------------------------------#
+#
+# RESERVED_MACRO_NAMES
+#
+# This file lists the macro names, other than the ones starting with a
+# certain set of allowed prefixes that are defined by the Mercury header files.
+# The Mmakefile target `check_headers' automatically checks that no other
+# macro names are defined. This is done to keep our headers namespace-clean,
+# i.e. ensure that we don't invade the user's namespace.
+#
+# This file is used as the argument to `fgrep -f'.
+# Lines starting with `#' will not match anything in the input,
+# and can thus be used as comments.
+# Other lines are treated as strings to match against.
+#
+#-----------------------------------------------------------------------------#
+# This is documented in the Mercury language reference manual
+# and defined by mercury_types.h.
+SUCCESS_INDICATOR
+#-----------------------------------------------------------------------------#
+# pid_t is only defined in mercury_conf.h if it is not present
+# in the system headers. I don't think there is a nice way to
+# prefix this without requiring a later version of autoconf (e.g. 2.52).
+pid_t
+#-----------------------------------------------------------------------------#
+# These are defined by boehm_gc/gc.h.
+__GC
+_GC_H
+#-----------------------------------------------------------------------------#
+# This is defined by mps_gc/code/mercury_mps.h,
+# which uses this macro for its header guard.
+# Normally it would be better to use uppercase for header guard macro names,
+# but that would be inconsistent with the coding style used in mps_gc/code.
+mercury_mps_h
+#-----------------------------------------------------------------------------#
+# These are defined by mercury_signal.h. The first is defined only temporarily,
+# and the second eliminates gratuitous differences between Linux versions.
+# 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