[m-rev.] diff: fix for `bool' conflict with GCC back-end.
Fergus Henderson
fjh at cs.mu.OZ.AU
Fri Jul 27 00:48:33 AEST 2001
Estimated hours taken: 1
Branches: main
Fix a conflict with `bool' that broke the GCC back-end in grade hlc.gc.
This showed up after I updated it to use GCC 3.0 sources.
(N.B. A better solution might be to rename our `bool' as something
else, e.g. `MR_bool'.)
runtime/mercury_std.h:
If IN_GCC is defined, #include the GCC header files "config.h"
and "system.h" before checking whether bool is defined.
This is needed to ensure that we get consistenty get GCC's definition
of `bool'.
compiler/gcc.m:
Don't include "config.h" and "system.h", since they're already included
by mercury_std.h, and because these header files can't be included twice.
Workspace: /home/hg2/public/test_mercury/test_dirs/hg/mercury
Index: compiler/gcc.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/gcc.m,v
retrieving revision 1.23
diff -u -d -r1.23 gcc.m
--- compiler/gcc.m 2001/05/08 05:36:50 1.23
+++ compiler/gcc.m 2001/07/26 14:40:12
@@ -679,8 +679,11 @@
#ifndef MC_GUARD_GCC_HEADERS
#define MC_GUARD_GCC_HEADERS
-#include ""gcc/config.h""
-#include ""gcc/system.h""
+#if 0
+ /* These two are already included from runtime/mercury_std.h. */
+ #include ""gcc/config.h""
+ #include ""gcc/system.h""
+#endif
#include ""gcc/gansidecl.h""
#include ""gcc/toplev.h""
#include ""gcc/tree.h""
Index: runtime/mercury_std.h
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/mercury_std.h,v
retrieving revision 1.17
diff -u -d -r1.17 mercury_std.h
--- runtime/mercury_std.h 2001/05/31 06:00:16 1.17
+++ runtime/mercury_std.h 2001/07/26 14:41:45
@@ -32,6 +32,18 @@
#define reg register
#endif
#endif
+
+#ifdef IN_GCC
+ /*
+ ** We need to make sure that we pick up GCC's definition of bool,
+ ** to ensure that we don't define `bool' below. Otherwise we get
+ ** conflicts because some declarations use the <stdbool.h> definition
+ ** of bool (an enum), and some use our definition (a #define for char)
+ */
+ #include "config.h"
+ #include "system.h"
+#endif
+
#ifndef bool
#define bool char
#endif
--
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