This is the mail archive of the 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]

make c-parse.y rules save against make -j

Running make -j4 with a biarch compiler on x86-64, two processes
created a tmp-c-parse.y file at the same time which lead to these
errors (the file contained the contents twice):

/bin/sh /usr/src/aj/Regression/sandbox/gcc/gcc/move-if-change tmp-c-parse.y /usr/src/aj/Regression/sandbox/gcc/gcc/c-parse.y
mv: cannot stat `tmp-c-parse.y': No such file or directory
c-parse.y: At top level:
c-parse.y:3149: parse error before '%' token
In file included from config.h:4,
                 from c-parse.y:3152:
auto-host.h:606:1: warning: "HAVE_AS_DWARF2_DEBUG_LINE" redefined

I've tested the appended patch successfully on x86-64.  The patch uses
unique file names to avoid such a race.

Ok to commit for both mainline and 3.3?


2003-02-05  Andreas Jaeger  <>

	* ($(parsedir)/c-parse.y): Use unique temporary
	filenames to avoid races with parallel build.

Index: gcc/
--- gcc/	3 Feb 2003 19:40:57 -0000	1.986
+++ gcc/	5 Feb 2003 08:55:08 -0000
@@ -1210,11 +1210,11 @@ $(parsedir)/c-parse.c: $(parsedir)/c-par
-	echo '/*WARNING: This file is automatically generated!*/' >tmp-c-parse.y
+	echo '/*WARNING: This file is automatically generated!*/' >tmp-$$$$c-parse.y; \
 	sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
 	  -e "/^ifc$$/d" -e "/^end ifc$$/d" \
-	  $(srcdir)/ >>tmp-c-parse.y
-	$(SHELL) $(srcdir)/move-if-change tmp-c-parse.y $(parsedir)/c-parse.y
+	  $(srcdir)/ >>tmp-$$$$c-parse.y; \
+	$(SHELL) $(srcdir)/move-if-change tmp-$$$$c-parse.y $(parsedir)/c-parse.y
 c-decl.o : c-decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) \
     $(C_TREE_H) $(GGC_H) $(TARGET_H) flags.h function.h output.h $(EXPR_H) \

 Andreas Jaeger
  SuSE Labs

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