[m-rev.] for review: fix bugs in namespace checks

Zoltan Somogyi zs at cs.mu.OZ.AU
Sat May 17 14:10:18 AEST 2003


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.

Zoltan.

cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
Index: browser/RESERVED_MACRO_NAMES
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/browser/RESERVED_MACRO_NAMES,v
retrieving revision 1.1
diff -u -b -r1.1 RESERVED_MACRO_NAMES
--- browser/RESERVED_MACRO_NAMES	24 Sep 2002 06:55:04 -0000	1.1
+++ browser/RESERVED_MACRO_NAMES	16 May 2003 10:18:22 -0000
@@ -37,3 +37,19 @@
 # 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__
+#-----------------------------------------------------------------------------#
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing java
cvs diff: Diffing java/library
cvs diff: Diffing java/runtime
cvs diff: Diffing library
Index: library/RESERVED_MACRO_NAMES
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/RESERVED_MACRO_NAMES,v
retrieving revision 1.1
diff -u -b -r1.1 RESERVED_MACRO_NAMES
--- library/RESERVED_MACRO_NAMES	24 Sep 2002 06:55:15 -0000	1.1
+++ library/RESERVED_MACRO_NAMES	16 May 2003 10:17:48 -0000
@@ -37,3 +37,19 @@
 # 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/io.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.295
diff -u -b -r1.295 io.m
--- library/io.m	1 Apr 2003 07:58:36 -0000	1.295
+++ library/io.m	17 May 2003 01:16:29 -0000
@@ -5587,7 +5587,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;
 ").
@@ -5634,7 +5634,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);
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
Index: tools/bootcheck
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/tools/bootcheck,v
retrieving revision 1.151
diff -u -b -r1.151 bootcheck
--- tools/bootcheck	15 May 2003 07:23:45 -0000	1.151
+++ tools/bootcheck	16 May 2003 07:01:50 -0000
@@ -504,12 +504,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
 		mkdir analysis
 		cd analysis
@@ -548,6 +550,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 .
cvs diff: Diffing trace
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	15 May 2003 12:04:18 -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__
+#-----------------------------------------------------------------------------#
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
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