This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

vec.c: $build vs $host


only slightly related to the libssp and libstdc++ bugs ;-)

In vec.c we include:

#include "config.h"
#include "system.h"

However, we build it for $build and $host:

vec.o : vec.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) coretypes.h vec.h $(GGC_H) \
   toplev.h
build/vec.o : vec.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) coretypes.h vec.h \
   $(GGC_H) toplev.h

This, obviously, blows up when build != host.

The others all depend on BCONFIG_H, not CONFIG_H.

Before I commit this patch, which I think is obvious, I would like to
propose this too: config.h should #error if it detects that
GENERATOR_FILE is set.  Does this sound reasonable?

2006-04-28  DJ Delorie  <dj@redhat.com>

	* vec.c: Include bconfig.h when appropriate.
	* Makefile.in (build/vec.o): Adjust dependencies.

Index: vec.c
===================================================================
--- vec.c	(revision 113341)
+++ vec.c	(working copy)
@@ -19,7 +19,14 @@ along with GCC; see the file COPYING.  I
 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
 02110-1301, USA.  */
 
+/* This file is compiled twice: once for the generator programs
+   once for the compiler.  */
+#ifdef GENERATOR_FILE
+#include "bconfig.h"
+#else
 #include "config.h"
+#endif
+
 #include "system.h"
 #include "ggc.h"
 #include "vec.h"
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 113341)
+++ Makefile.in	(working copy)
@@ -2927,7 +2927,7 @@ build/read-rtl.o: read-rtl.c $(BCONFIG_H
   $(GTM_H) $(RTL_BASE_H) $(OBSTACK_H) $(HASHTAB_H) gensupport.h
 build/rtl.o: rtl.c $(BCONFIG_H) coretypes.h $(GTM_H) $(SYSTEM_H)	\
   $(RTL_H) $(REAL_H) $(GGC_H) errors.h
-build/vec.o : vec.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) coretypes.h vec.h \
+build/vec.o : vec.c $(BCONFIG_H) $(SYSTEM_H) $(TREE_H) coretypes.h vec.h \
    $(GGC_H) toplev.h
 build/gencondmd.o : build/gencondmd.c $(BCONFIG_H) $(SYSTEM_H)		\
   coretypes.h $(GTM_H) insn-constants.h $(RTL_H) $(TM_P_H)		\


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]