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]

[PATCH] Fix building of gengtype


Hi!

My last 2 bootstraps failed, both because of a race while building
host gengtype (each time different gengtype*.o).

Looking at the history, we have two versions of gengtype, one in build/,
another one in . (host one).
Initially, the copy in build/ was built with -DGENERATOR_FILE, included
bconfig.h, the other did not and included config.h.
Then, Steven noticed that eventhough gengtype is built for host, it really
for many reasons need GENERATOR_FILE define and defined it in the Makefile.
Except that change resulted in always including bconfig.h even in host
gengtype, which is presumably undesirable.
After another half a year Marcus probably hit similar race like I did
tonight, make trying to build host gengtype*.o when bconfig.h has not been
generated yet, and added for gengtype-lex.o $(BCONFIG_H) dependency
(but not to any other of the gengtype*.o files).

Note, config.h has an #error for #ifdef GENERATOR_FILE, to prevent people
from including config.h in build/gen* stuff by mistake.

So, this patch fixes this by just using a different define and defines
GENERATOR_FILE only after including config.h in the host gengtype* object
files.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2014-11-25  Jakub Jelinek  <jakub@redhat.com>

	* Makefile.in (gengtype-lex.o): Drop dependency on $(BCONFIG_H).
	(CFLAGS-gengtype-lex.o, CFLAGS-gengtype-parse.o,
	CFLAGS-gengtype-state.o, CFLAGS-gengtype.o): Add -DHOST_GENGTYPE
	instead of -DGENERATOR_FILE.
	* gengtype.c: Instead of testing GENERATOR_FILE define, test
	HOST_GENGTYPE.  If defined, include config.h and define GENERATOR_FILE
	afterwards, otherwise include bconfig.h.
	* gengtype-parse.c, gengtype-state.c, gengtype-lex.l): Likewise.

--- gcc/Makefile.in.jj	2014-11-18 18:17:53.000000000 +0100
+++ gcc/Makefile.in	2014-11-24 21:43:47.960196848 +0100
@@ -2485,27 +2485,27 @@ build/gengenrtl.o : gengenrtl.c $(BCONFI
 # the build-%: rule doesn't apply to them.
 
 gengtype-lex.o build/gengtype-lex.o : gengtype-lex.c gengtype.h $(SYSTEM_H)
-gengtype-lex.o: $(CONFIG_H) $(BCONFIG_H)
-CFLAGS-gengtype-lex.o += -DGENERATOR_FILE
+gengtype-lex.o: $(CONFIG_H)
+CFLAGS-gengtype-lex.o += -DHOST_GENGTYPE
 build/gengtype-lex.o: $(BCONFIG_H)
 
 gengtype-parse.o build/gengtype-parse.o : gengtype-parse.c gengtype.h \
   $(SYSTEM_H)
 gengtype-parse.o: $(CONFIG_H)
-CFLAGS-gengtype-parse.o += -DGENERATOR_FILE
+CFLAGS-gengtype-parse.o += -DHOST_GENGTYPE
 build/gengtype-parse.o: $(BCONFIG_H)
 
 gengtype-state.o build/gengtype-state.o: gengtype-state.c $(SYSTEM_H) \
   gengtype.h errors.h double-int.h version.h $(HASHTAB_H) $(OBSTACK_H) \
   $(XREGEX_H)
 gengtype-state.o: $(CONFIG_H)
-CFLAGS-gengtype-state.o += -DGENERATOR_FILE
+CFLAGS-gengtype-state.o += -DHOST_GENGTYPE
 build/gengtype-state.o: $(BCONFIG_H)
 gengtype.o build/gengtype.o : gengtype.c $(SYSTEM_H) gengtype.h 	\
   rtl.def insn-notes.def errors.h double-int.h version.h     		\
   $(HASHTAB_H) $(OBSTACK_H) $(XREGEX_H)
 gengtype.o: $(CONFIG_H)
-CFLAGS-gengtype.o += -DGENERATOR_FILE
+CFLAGS-gengtype.o += -DHOST_GENGTYPE
 build/gengtype.o: $(BCONFIG_H)
 
 build/genmddeps.o: genmddeps.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h	\
--- gcc/gengtype.c.jj	2014-11-20 17:06:24.000000000 +0100
+++ gcc/gengtype.c	2014-11-24 21:44:30.746446814 +0100
@@ -17,10 +17,11 @@
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
-#ifdef GENERATOR_FILE
-#include "bconfig.h"
-#else
+#ifdef HOST_GENGTYPE
 #include "config.h"
+#define GENERATOR_FILE 1
+#else
+#include "bconfig.h"
 #endif
 #include "system.h"
 #include "errors.h"		/* for fatal */
--- gcc/gengtype-parse.c.jj	2014-09-25 15:03:05.000000000 +0200
+++ gcc/gengtype-parse.c	2014-11-24 21:45:19.905585065 +0100
@@ -17,10 +17,11 @@
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
-#ifdef GENERATOR_FILE
-#include "bconfig.h"
-#else
+#ifdef HOST_GENGTYPE
 #include "config.h"
+#define GENERATOR_FILE 1
+#else
+#include "bconfig.h"
 #endif
 #include "system.h"
 #include "gengtype.h"
--- gcc/gengtype-state.c.jj	2014-09-25 15:01:57.000000000 +0200
+++ gcc/gengtype-state.c	2014-11-24 21:44:59.293946382 +0100
@@ -23,10 +23,11 @@
    and Basile Starynkevitch <basile@starynkevitch.net>
 */
 
-#ifdef GENERATOR_FILE
-#include "bconfig.h"
-#else
+#ifdef HOST_GENGTYPE
 #include "config.h"
+#define GENERATOR_FILE 1
+#else
+#include "bconfig.h"
 #endif
 #include "system.h"
 #include "errors.h"	/* For fatal.  */
--- gcc/gengtype-lex.l.jj	2014-09-25 15:02:45.000000000 +0200
+++ gcc/gengtype-lex.l	2014-11-24 21:45:41.486206761 +0100
@@ -21,10 +21,11 @@ along with GCC; see the file COPYING3.
 %option noinput
 
 %{
-#ifdef GENERATOR_FILE
-#include "bconfig.h"
-#else
+#ifdef HOST_GENGTYPE
 #include "config.h"
+#define GENERATOR_FILE 1
+#else
+#include "bconfig.h"
 #endif
 #include "system.h"
 

	Jakub


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