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]

[PATCH 2.95.3] [RESEND] Rename $(libsubdir)/cpp to cpp0


This is the patch from 2.96+ to rename the internal preprocessor to
'cpp0'.  Without it, if gcc is mis-installed, /bin/cpp can wind up
recursively invoking itself when it tries to execute $(libsubdir)/cpp.
Repeat until the process table overflows, or you run out of swap.

With the patch, under the same conditions there is no infinite
recursion, only a helpful error message:

cpp: installation problem, cannot exec `cpp0': No such file or directory

I sent this about a week ago, but no one said anything about it.

zw

2000-12-10  Zack Weinberg  <zack@wolery.stanford.edu>

	Backport from HEAD:
	2000-07-31  Zack Weinberg  <zack@wolery.cumb.org>

        * Makefile.in: Rename cpp to cpp0, tradcpp to tradcpp0, and
        xcpp to cpp throughout.
        (native): Remove unnecessary dependency on cpp.
	* gcc.c (C specs): Call cpp0 to do preprocessing, not cpp.

	* ch/lang-specs.h, cp/lang-specs.h, f/lang-specs.h,
	objc/lang-specs.h: Call cpp0 to do preprocessing, not cpp.

===================================================================
Index: Makefile.in
--- Makefile.in	1999/08/13 07:46:55	1.264.4.6
+++ Makefile.in	2000/12/01 01:10:39
@@ -441,7 +441,7 @@ COMPILERS = cc1$(exeext) @all_compilers@
 
 # List of things which should already be built whenever we try to use xgcc
 # to compile anything (without linking).
-GCC_PASSES=xgcc$(exeext) cc1$(exeext) cpp$(exeext) $(EXTRA_PASSES)
+GCC_PASSES=xgcc$(exeext) cc1$(exeext) cpp0$(exeext) $(EXTRA_PASSES)
 
 # List of things which should already be built whenever we try to use xgcc
 # to link anything.
@@ -704,7 +704,7 @@ STAGESTUFF = *$(objext) insn-flags.h ins
  genconfig$(build_exeext) genpeep$(build_exeext) genattrtab$(build_exeext) \
  genattr$(build_exeext) genopinit$(build_exeext) gengenrtl$(build_exeext) \
  gencheck$(build_exeext) \
- xgcc$(exeext) xcpp$(exeext) cc1$(exeext) cpp$(exeext) $(EXTRA_PASSES) \
+ xgcc$(exeext) cpp$(exeext) cc1$(exeext) cpp0$(exeext) $(EXTRA_PASSES) \
  $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross$(exeext) \
  $(CCCP)$(exeext) cc1obj$(exeext) enquire$(exeext) \
  protoize$(exeext) unprotoize$(exeext) \
@@ -840,15 +840,15 @@ all.internal: start.encap rest.encap doc
 all.cross: native gcc-cross specs stmp-headers $(STMP_FIXPROTO) $(LIBGCC) \
 	$(LIBGCC1_TEST) $(EXTRA_PARTS) lang.all.cross doc
 # This is what to compile if making gcc with a cross-compiler.
-all.build: native xgcc$(exeext) xcpp$(exeext) $(EXTRA_PARTS) lang.all.build
+all.build: native xgcc$(exeext) cpp$(exeext) $(EXTRA_PARTS) lang.all.build
 # This is what must be made before installing GCC and converting libraries.
-start.encap: native xgcc$(exeext) xcpp$(exeext) specs $(LIBGCC1) \
+start.encap: native xgcc$(exeext) cpp$(exeext) specs $(LIBGCC1) \
 	xlimits.h lang.start.encap
 # These can't be made until after GCC can run.
 rest.encap: stmp-headers $(STMP_FIXPROTO) $(LIBGCC) $(EXTRA_PARTS) lang.rest.encap
 # This is what is made with the host's compiler
 # whether making a cross compiler or not.
-native: config.status auto-host.h cpp$(exeext) intl.all $(LANGUAGES) \
+native: config.status auto-host.h intl.all $(LANGUAGES) \
 	$(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2)
 
 # Define the names for selecting languages in LANGUAGES.
@@ -893,7 +893,7 @@ xgcc$(exeext): gcc.o gccspec.o version.o
 # when it is installed.
 # The only difference from xgcc is that it's linked with cppspec.o
 # instead of gccspec.o.
-xcpp$(exeext): gcc.o cppspec.o version.o intl.o prefix.o \
+cpp$(exeext): gcc.o cppspec.o version.o intl.o prefix.o \
    version.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gcc.o cppspec.o intl.o \
 	  prefix.o version.o $(EXTRA_GCC_OBJS) $(LIBS)
@@ -1953,9 +1953,9 @@ intl.distdir-fixup:
 # Remake cpp and protoize.
 
 # Making the preprocessor
-cpp$(exeext): $(CCCP)$(exeext)
-	-rm -f cpp$(exeext)
-	$(LN) $(CCCP)$(exeext) cpp$(exeext)
+cpp0$(exeext): $(CCCP)$(exeext)
+	-rm -f cpp0$(exeext)
+	$(LN) $(CCCP)$(exeext) cpp0$(exeext)
 CCCP_OBJS = cccp.o cexp.o intl.o prefix.o version.o @extra_cpp_objs@ mbchar.o 
 cccp$(exeext): $(CCCP_OBJS) $(LIBDEPS)
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(CCCP_OBJS) $(LIBS)
@@ -2448,12 +2448,12 @@ install-build: force
 install-cross-rest: install-float-h-cross
 
 # Handle cpp installation.
-install-cpp: xcpp$(exeext)
+install-cpp: cpp$(exeext)
 	-rm -f $(bindir)/$(CPP_INSTALL_NAME)$(exeext)
-	$(INSTALL_PROGRAM) -m 755 xcpp$(exeext) $(bindir)/$(CPP_INSTALL_NAME)$(exeext)
+	$(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(bindir)/$(CPP_INSTALL_NAME)$(exeext)
 	if [ x$(cpp_install_dir) != x ]; then \
 	  rm -f $(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
-	  $(INSTALL_PROGRAM) -m 755 xcpp$(exeext) $(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
+	  $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
 	else true; fi
 
 uninstall-cpp:
@@ -2544,8 +2544,8 @@ install-common: native installdirs $(EXT
 	    $(INSTALL_DATA) SYSCALLS.c.X $(libsubdir)/SYSCALLS.c.X; \
 	    chmod a-x $(libsubdir)/SYSCALLS.c.X; \
 	fi
-	-rm -f $(libsubdir)/cpp$(exeext)
-	$(INSTALL_PROGRAM) cpp$(exeext) $(libsubdir)/cpp$(exeext)
+	-rm -f $(libsubdir)/cpp0$(exeext)
+	$(INSTALL_PROGRAM) cpp0$(exeext) $(libsubdir)/cpp0$(exeext)
 # Install gcov if it was compiled.
 	-if [ -f gcov$(exeext) ]; \
 	then \
===================================================================
Index: gcc.c
--- gcc.c	2000/02/18 17:19:28	1.102.4.4
+++ gcc.c	2000/12/01 01:10:41
@@ -594,7 +594,7 @@ static struct compiler default_compilers
   {"@c",
    {
 #if USE_CPPLIB
-     "%{E|M|MM:cpp -lang-c %{ansi:-std=c89} %{std*} %{nostdinc*}\
+     "%{E|M|MM:cpp0 -lang-c %{ansi:-std=c89} %{std*} %{nostdinc*}\
 	%{C} %{v} %{A*} %{I*} %{P} %{$} %I\
 	%{C:%{!E:%eGNU C does not support -C without using -E}}\
 	%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
@@ -630,7 +630,7 @@ static struct compiler default_compilers
 		     %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\
                      %{!pipe:%g.s} %A\n }}}}"
 #else /* ! USE_CPPLIB */
-    "cpp -lang-c %{ansi:-std=c89} %{std*} %{nostdinc*}\
+    "cpp0 -lang-c %{ansi:-std=c89} %{std*} %{nostdinc*}\
 	%{C} %{v} %{A*} %{I*} %{P} %{$} %I\
 	%{C:%{!E:%eGNU C does not support -C without using -E}}\
 	%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
@@ -658,7 +658,7 @@ static struct compiler default_compilers
 #endif /* ! USE_CPPLIB */
   }},
   {"-",
-   {"%{E:cpp -lang-c %{ansi:-std=c89} %{std*} %{nostdinc*}\
+   {"%{E:cpp0 -lang-c %{ansi:-std=c89} %{std*} %{nostdinc*}\
 	%{C} %{v} %{A*} %{I*} %{P} %{$} %I\
 	%{C:%{!E:%eGNU C does not support -C without using -E}}\
 	%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
@@ -676,7 +676,7 @@ static struct compiler default_compilers
   {".h", {"@c-header"}},
   {"@c-header",
    {"%{!E:%eCompilation of header file requested} \
-    cpp %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
+    cpp0 %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
 	%{C:%{!E:%eGNU C does not support -C without using -E}}\
 	%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
         %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\
@@ -707,7 +707,7 @@ static struct compiler default_compilers
 			    %i %A\n }}}}"}},
   {".S", {"@assembler-with-cpp"}},
   {"@assembler-with-cpp",
-   {"cpp -lang-asm %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
+   {"cpp0 -lang-asm %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
 	%{C:%{!E:%eGNU C does not support -C without using -E}}\
 	%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG} %{trigraphs}\
         -$ %{!undef:%p %P} -D__ASSEMBLER__ \
===================================================================
Index: ch/lang-specs.h
--- ch/lang-specs.h	1999/05/17 23:33:05	1.9
+++ ch/lang-specs.h	2000/12/01 01:10:41
@@ -24,7 +24,7 @@ Boston, MA 02111-1307, USA.  */
   {".ch",  {"@chill"}},
   {".chi", {"@chill"}},
   {"@chill",
-     {"cpp -lang-chill %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
+     {"cpp0 -lang-chill %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
 	%{C:%{!E:%eGNU CHILL does not support -C without using -E}}\
         %{!no-gcc:-D__GNUCHILL__=%v1 -D__GNUC_MINOR__=%v2}\
         %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\
===================================================================
Index: cp/lang-specs.h
--- cp/lang-specs.h	1999/05/17 23:28:09	1.17
+++ cp/lang-specs.h	2000/12/01 01:10:41
@@ -30,7 +30,7 @@ Boston, MA 02111-1307, USA.  */
   {"@c++",
 #if USE_CPPLIB
    {
-     "%{E|M|MM:cpp -lang-c++ %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
+     "%{E|M|MM:cpp0 -lang-c++ %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
 	%{C:%{!E:%eGNU C++ does not support -C without using -E}}\
 	%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
 	%{!no-gcc:-D__GNUC__=%v1 -D__GNUG__=%v1 -D__GNUC_MINOR__=%v2}\
@@ -62,7 +62,7 @@ Boston, MA 02111-1307, USA.  */
 		      %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\
                       %{!pipe:%g.s} %A\n }}}}"}},
 #else /* ! USE_CPPLIB */
-   {"cpp -lang-c++ %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
+   {"cpp0 -lang-c++ %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
 	%{C:%{!E:%eGNU C++ does not support -C without using -E}}\
 	%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
 	%{!no-gcc:-D__GNUC__=%v1 -D__GNUG__=%v1 -D__GNUC_MINOR__=%v2}\
===================================================================
Index: f/lang-specs.h
--- f/lang-specs.h	1999/05/17 23:35:15	1.15
+++ f/lang-specs.h	2000/12/01 01:10:41
@@ -35,7 +35,7 @@ the Free Software Foundation, 59 Temple 
 	Sun f77, at least) so you test `__unix' rather than `unix'.
 	-D_LANGUAGE_FORTRAN is used by some compilers like SGI and
 	might as well be in there. */
-   {"cpp -lang-c %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
+   {"cpp0 -lang-c %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
 	%{C:%{!E:%eGNU C does not support -C without using -E}}\
 	%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
 	%{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\
@@ -85,7 +85,7 @@ the Free Software Foundation, 59 Temple 
 		      %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\
 		      %{!pipe:%g.s} %A\n }}}}"}},
   {"@f77-version",
-   {"cpp -lang-c %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I \
+   {"cpp0 -lang-c %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I \
       %{C:%{!E:%eGNU C does not support -C without using -E}} \
       %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG} \
       %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2} \
===================================================================
Index: objc/lang-specs.h
--- objc/lang-specs.h	1999/05/17 23:37:19	1.9
+++ objc/lang-specs.h	2000/12/01 01:10:41
@@ -24,7 +24,7 @@ Boston, MA 02111-1307, USA.  */
   {".m", {"@objective-c"}},
   {"@objective-c",
 #if USE_CPPLIB
-   {"%{E|M|MM:cpp -lang-objc %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
+   {"%{E|M|MM:cpp0 -lang-objc %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
 	%{C:%{!E:%eGNU C does not support -C without using -E}}\
 	%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
         -D__OBJC__ %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\
@@ -55,7 +55,7 @@ Boston, MA 02111-1307, USA.  */
 	%{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\
         %{!pipe:%g.s} %A\n }}}}"}
 #else /* ! USE_CPPLIB */
-   {"cpp -lang-objc %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
+   {"cpp0 -lang-objc %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
 	%{C:%{!E:%eGNU C does not support -C without using -E}}\
 	%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
         -D__OBJC__ %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\

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