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]

Integrated cpp: hack specs so -traditional and -save-temps work


This extends the previous patch so that -save-temps works with the
integrated preprocessor.

Bootstrapped with no regressions.  OK?

Neil.

 	* gcc.c (cpp_options_common): Renamed from cpp_options; this
 	forms the specs common to preprocessing assembly and C.
 	(cpp_options): cpp_options_asm with -lang-c and -ansi.
	(cc1_options): add invocation of as to reduce duplication.
 	Simplify existing specs to use these 2 changes.
 	Add specs to invoke tradcpp0 on the integrated preprocessor
 	if any of -traditional, -traditional-cpp or -ftraditional
 	is specified, passing the output to cc1.
	Add specs to invoke the relevant preprocessor if
	-save-temps is specified.

Index: gcc.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/gcc.c,v
retrieving revision 1.168
diff -c -p -r1.168 gcc.c
*** gcc.c	2000/09/20 20:06:54	1.168
--- gcc.c	2000/09/23 11:50:06
*************** static const char *trad_capable_cpp =
*** 570,575 ****
--- 570,579 ----
  "%{traditional|ftraditional|traditional-cpp:trad}cpp0";
  
  static const char *cpp_options =
+ "-lang-c %{ansi:-std=c89} %(cpp_options_common)";
+ 
+ /* These CPP specs are common to assembler and C.  */
+ static const char *cpp_options_common =
  "%{C:%{!E:%eGNU C does not support -C without using -E}}\
   %{std*} %{nostdinc*}\
   %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
*************** static const char *cpp_options =
*** 586,599 ****
   %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{U*} %{D*} %{i*} %Z %i\
   %{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}}";
  
  static const char *cc1_options =
  "%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
   %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*}\
   %{g*} %{O*} %{W*} %{w} %{pedantic*} %{std*} %{ansi}\
   %{traditional} %{v:-version} %{pg:-p} %{p} %{f*}\
   %{aux-info*} %{Qn:-fno-ident} %{--help:--help}\
!  %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}}\
!  %{fsyntax-only:-o %j}";
  
  static const char *asm_options =
  "%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}";
--- 590,606 ----
   %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{U*} %{D*} %{i*} %Z %i\
   %{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}}";
  
+ /* Includes the invokation, if any, of as.  */
  static const char *cc1_options =
  "%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
   %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*}\
   %{g*} %{O*} %{W*} %{w} %{pedantic*} %{std*} %{ansi}\
   %{traditional} %{v:-version} %{pg:-p} %{p} %{f*}\
   %{aux-info*} %{Qn:-fno-ident} %{--help:--help}\
!  %{fsyntax-only:-o %j}\
!  %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}\
! 		 %{!S:-o %{|!pipe:%g.s} |\n\
! 		 as %(asm_options) %{!pipe:%g.s} %A }}";
  
  static const char *asm_options =
  "%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}";
*************** static struct compiler default_compilers
*** 709,743 ****
    {".c", "@c"},
    {"@c",
  #if USE_CPPLIB
!      "%{E|M|MM:%(trad_capable_cpp) -lang-c %{ansi:-std=c89} %(cpp_options)}\
!       %{!E:%{!M:%{!MM:cc1 -lang-c %{ansi:-std=c89} %(cpp_options)\
! 			  %(cc1_options) %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\
!       as %(asm_options) %{!pipe:%g.s} %A }}}}}"
  #else /* ! USE_CPPLIB */
!      "%(trad_capable_cpp) -lang-c %{ansi:-std=c89} %(cpp_options) \
! 			  %{!M:%{!MM:%{!E:%{!pipe:%g.i} |\n\
!       cc1 %{!pipe:%g.i} %(cc1_options) %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\
!       as %(asm_options) %{!pipe:%g.s} %A }}}}}\n"
  #endif /* ! USE_CPPLIB */
    },
    {"-",
     "%{!E:%e-E required when input is from standard input}\
!     %(trad_capable_cpp) -lang-c %{ansi:-std=c89} %(cpp_options)"},
    {".h", "@c-header"},
    {"@c-header",
     "%{!E:%eCompilation of header file requested} \
!     %(trad_capable_cpp) -lang-c %{ansi:-std=c89} %(cpp_options)"},
    {".i", "@cpp-output"},
    {"@cpp-output",
!    "%{!M:%{!MM:%{!E:\
!     cc1 %i %(cc1_options) %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\
!     as %(asm_options) %{!pipe:%g.s} %A }}}}}"},
    {".s", "@assembler"},
    {"@assembler",
     "%{!M:%{!MM:%{!E:%{!S:as %(asm_options) %i %A }}}}"},
    {".S", "@assembler-with-cpp"},
    {"@assembler-with-cpp",
!    "%(trad_capable_cpp) -lang-asm %(cpp_options) \
  			%{!M:%{!MM:%{!E:%{!S: %{!pipe:%g.s} |\n\
      as %(asm_options) %{!pipe:%g.s} %A }}}}"},
  #include "specs.h"
--- 716,750 ----
    {".c", "@c"},
    {"@c",
  #if USE_CPPLIB
!      "%{E|M|MM:%(trad_capable_cpp) %(cpp_options)}\
!       %{!E:%{!M:%{!MM:\
! 	%{save-temps:%(trad_capable_cpp) %(cpp_options) %b.i \n\
! 		cc1 %b.i %(cc1_options)}
! 	%{!save-temps:%{traditional|ftraditional|traditional-cpp:\
! 	  tradcpp0 %(cpp_options) %{!pipe:%g.i} |\n cc1 %{!pipe:%g.i}} \
! 		      %{!traditional:%{!ftraditional:%{!traditional-cpp:\
! 	  cc1 %(cpp_options)}}} %(cc1_options) }}}}"
  #else /* ! USE_CPPLIB */
!      "%(trad_capable_cpp) %(cpp_options) %{!M:%{!MM:%{!E:
! 	%{!pipe:%g.i} |\n cc1 %{!pipe:%g.i} %(cc1_options) }}}"
  #endif /* ! USE_CPPLIB */
    },
    {"-",
     "%{!E:%e-E required when input is from standard input}\
!     %(trad_capable_cpp) %(cpp_options)"},
    {".h", "@c-header"},
    {"@c-header",
     "%{!E:%eCompilation of header file requested} \
!     %(trad_capable_cpp) %(cpp_options)"},
    {".i", "@cpp-output"},
    {"@cpp-output",
!    "%{!M:%{!MM:%{!E:cc1 %i %(cc1_options) }}}"},
    {".s", "@assembler"},
    {"@assembler",
     "%{!M:%{!MM:%{!E:%{!S:as %(asm_options) %i %A }}}}"},
    {".S", "@assembler-with-cpp"},
    {"@assembler-with-cpp",
!    "%(trad_capable_cpp) -lang-asm %(cpp_options_common) \
  			%{!M:%{!MM:%{!E:%{!S: %{!pipe:%g.s} |\n\
      as %(asm_options) %{!pipe:%g.s} %A }}}}"},
  #include "specs.h"
*************** static struct spec_list static_specs[] =
*** 1085,1090 ****
--- 1092,1098 ----
    INIT_STATIC_SPEC ("asm_options",		&asm_options),
    INIT_STATIC_SPEC ("cpp",			&cpp_spec),
    INIT_STATIC_SPEC ("cpp_options",		&cpp_options),
+   INIT_STATIC_SPEC ("cpp_options_common",	&cpp_options_common),
    INIT_STATIC_SPEC ("trad_capable_cpp",		&trad_capable_cpp),
    INIT_STATIC_SPEC ("cc1",			&cc1_spec),
    INIT_STATIC_SPEC ("cc1_options",		&cc1_options),

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