[m-dev.] diff: GCC back-end: fixes for building in hlc.gc

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Jan 18 23:07:41 AEDT 2001


Estimated hours taken: 0.75

Fix some problems that broke the GCC back-end interface
when the compiler was builtin in hlc* grades.

mercury/compiler/gcc.m:
mercury/compiler/mlds_to_gcc.m:
	Add a macro guard around the #includes of the GCC
	headers, since the GCC headers aren't safe against
	multiple inclusion.

	#include the GCC headers using "gcc/" prefixes.
	This avoids a clash between mercury/compiler/tree.h
	(which is generated from mercury/compiler/tree.m)
	and gcc/tree.h.

mercury/compiler/Mmakefile:
	Include $(GCC_SRC_DIR) in the include search path, so that
	#including the GCC headers using "gcc/" prefixes works.

Workspace: /home/hg/fjh/gcc-cvs/gcc/mercury
Index: compiler/gcc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/gcc.m,v
retrieving revision 1.14
diff -u -d -r1.14 gcc.m
--- compiler/gcc.m	2001/01/17 01:45:17	1.14
+++ compiler/gcc.m	2001/01/17 17:14:00
@@ -589,14 +589,20 @@
 
 :- pragma c_header_code("
 
-#include ""config.h""
-#include ""system.h""
-#include ""gansidecl.h""
-#include ""tree.h""
+#ifndef MC_GUARD_GCC_HEADERS
+#define MC_GUARD_GCC_HEADERS
+
+#include ""gcc/config.h""
+#include ""gcc/system.h""
+#include ""gcc/gansidecl.h""
+#include ""gcc/toplev.h""
+#include ""gcc/tree.h""
 /* XXX we should eliminate the dependency on the C front-end */
-#include ""c-tree.h""
+#include ""gcc/c-tree.h""
 
-#include ""mercury-gcc.h""
+#include ""gcc/mercury/mercury-gcc.h""
+
+#endif
 
 ").
 
Index: compiler/mlds_to_gcc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_gcc.m,v
retrieving revision 1.19
diff -u -d -r1.19 mlds_to_gcc.m
--- compiler/mlds_to_gcc.m	2001/01/18 04:55:47	1.19
+++ compiler/mlds_to_gcc.m	2001/01/18 04:56:02
@@ -250,12 +250,21 @@
 ").
 
 :- pragma c_code("
-#include ""config.h""
-#include ""system.h""
-#include ""gansidecl.h""
-#include ""toplev.h""
-#include ""tree.h""
-#include ""mercury-gcc.h""
+
+#ifndef MC_GUARD_GCC_HEADERS
+#define MC_GUARD_GCC_HEADERS
+
+#include ""gcc/config.h""
+#include ""gcc/system.h""
+#include ""gcc/gansidecl.h""
+#include ""gcc/toplev.h""
+#include ""gcc/tree.h""
+/* XXX we should eliminate the dependency on the C front-end */
+#include ""gcc/c-tree.h""
+
+#include ""gcc/mercury/mercury-gcc.h""
+
+#endif /* MC_GUARD_GCC_HEADERS */
 
 /* We use an `MC_' prefix for C code in the mercury/compiler directory. */
 MR_Word MC_mlds;
Index: compiler/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Mmakefile,v
retrieving revision 1.39
diff -u -d -r1.39 Mmakefile
--- compiler/Mmakefile	2001/01/17 02:43:07	1.39
+++ compiler/Mmakefile	2001/01/17 16:24:03
@@ -108,6 +108,7 @@
 		-I$(GCC_SRC_DIR)/gcc/mercury \
 		-I$(GCC_SRC_DIR)/gcc/config \
 		-I$(GCC_SRC_DIR)/include \
+		-I$(GCC_SRC_DIR)
 # Likewise for mlds_to_gcc.m
 CFLAGS-mlds_to_gcc = $(CFLAGS-gcc)
 

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list