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: final take on -save-temps and -traditional


This patch bootstraps all front ends both with and without integrated
cpp, and introduces no new regressions in either case.

It consists of 2 steps:

a) define a new spec invoke_as, without which things would get really
verbose.  Update all specs to use this.

b) Update c, c++ and objc specs to handle -save-temps and -traditional
(except the c++ frontend).

Also add a cpp spec for the -ftabstop= option.

OK to commit?

Neil.

	* gcc.c (cpp_options): Add spec for -ftabstop=.
	(invoke_as): New spec that handles invoking as.
	Update specs to handle -save-temps and -traditional.
	* ch/lang-specs.h, f/lang-specs.h, java/lang-specs.h:
	Use invoke_as.
	* cp/lang-specs.h, objc/lang-specs.h: Update to use
	invoke_as, and handle -save-temps and -traditional (if
	appropriate).

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/24 09:22:10
*************** static const char *cpp_options =
*** 583,591 ****
--- 583,593 ----
   %{!ffreestanding:%{!fno-hosted:-D__STDC_HOSTED__=1}}\
   %{fshow-column} %{fno-show-column}\
   %{fleading-underscore} %{fno-leading-underscore}\
+  %{ftabstop=*}\
   %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{U*} %{D*} %{i*} %Z %i\
   %{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}}";
  
+ /* NB: This is shared amongst all front-ends.  */
  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*}\
*************** static const char *cc1_options =
*** 598,603 ****
--- 600,608 ----
  static const char *asm_options =
  "%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}";
  
+ static const char *invoke_as =
+ "%{!S:-o %{|!pipe:%g.s} |\n as %(asm_options) %{!pipe:%g.s} %A }";
+ 
  /* Some compilers have limits on line lengths, and the multilib_select
     and/or multilib_matches strings can be very long, so we build them at
     run time.  */
*************** static struct compiler default_compilers
*** 709,723 ****
    {".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 */
    },
    {"-",
--- 714,737 ----
    {".c", "@c"},
    {"@c",
  #if USE_CPPLIB
+    /* cc1 has an integrated ISO C preprocessor.  We should invoke the
+       external preprocessor if -save-temps or -traditional is given.  */
       "%{E|M|MM:%(trad_capable_cpp) -lang-c %{ansi:-std=c89} %(cpp_options)}\
!       %{!E:%{!M:%{!MM:\
! 	  %{save-temps:%(trad_capable_cpp) -lang-c %{ansi:-std=c89}\
! 		%(cpp_options) %b.i \n\
! 		    cc1 -fpreprocessed %b.i %(cc1_options)}\
! 	  %{!save-temps:\
! 	    %{traditional|ftraditional|traditional-cpp:\
! 		tradcpp0 -lang-c %{ansi:-std=c89} %(cpp_options) %{!pipe:%g.i} |\n\
! 		    cc1 -fpreprocessed %{!pipe:%g.i} %(cc1_options)}\
! 	    %{!traditional:%{!ftraditional:%{!traditional-cpp:\
! 		cc1 -lang-c %{ansi:-std=c89} %(cpp_options) %(cc1_options)}}}}\
!         %{!fsyntax-only:%(invoke_as)}}}}"
  #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:%(invoke_as)}}}}"
  #endif /* ! USE_CPPLIB */
    },
    {"-",
*************** static struct compiler default_compilers
*** 729,745 ****
      %(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"
    /* Mark end of table */
    {0, 0}
--- 743,756 ----
      %(trad_capable_cpp) -lang-c %{ansi:-std=c89} %(cpp_options)"},
    {".i", "@cpp-output"},
    {"@cpp-output",
!    "%{!M:%{!MM:%{!E:cc1 %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}"},
    {".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:%(invoke_as)}}}"},
  #include "specs.h"
    /* Mark end of table */
    {0, 0}
*************** static struct spec_list static_specs[] =
*** 1083,1088 ****
--- 1094,1100 ----
    INIT_STATIC_SPEC ("asm",			&asm_spec),
    INIT_STATIC_SPEC ("asm_final",		&asm_final_spec),
    INIT_STATIC_SPEC ("asm_options",		&asm_options),
+   INIT_STATIC_SPEC ("invoke_as",		&invoke_as),
    INIT_STATIC_SPEC ("cpp",			&cpp_spec),
    INIT_STATIC_SPEC ("cpp_options",		&cpp_options),
    INIT_STATIC_SPEC ("trad_capable_cpp",		&trad_capable_cpp),
Index: ch/lang-specs.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ch/lang-specs.h,v
retrieving revision 1.15
diff -c -p -r1.15 lang-specs.h
*** lang-specs.h	2000/08/21 18:10:29	1.15
--- lang-specs.h	2000/09/24 09:22:10
*************** Boston, MA 02111-1307, USA.  */
*** 27,31 ****
       "tradcpp0 -lang-chill %{!no-gcc:-D__GNUCHILL__=%v1} %(cpp_options)\
  	      %{!M:%{!MM:%{!E:%{!pipe:%g.i} |\n\
        cc1chill %{!pipe:%g.i} %(cc1_options)\
!       %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\
!       as %(asm_options) %{!pipe:%g.s} %A }}}}}\n"},
--- 27,30 ----
       "tradcpp0 -lang-chill %{!no-gcc:-D__GNUCHILL__=%v1} %(cpp_options)\
  	      %{!M:%{!MM:%{!E:%{!pipe:%g.i} |\n\
        cc1chill %{!pipe:%g.i} %(cc1_options)\
!       %{!fsyntax-only:%(invoke_as)}}}}\n"},
Index: cp/lang-specs.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/lang-specs.h,v
retrieving revision 1.29
diff -c -p -r1.29 lang-specs.h
*** lang-specs.h	2000/09/07 00:37:13	1.29
--- lang-specs.h	2000/09/24 09:22:16
*************** Boston, MA 02111-1307, USA.  */
*** 30,57 ****
    {".C",   "@c++"},
    {"@c++",
  #if USE_CPPLIB
      "%{E|M|MM:cpp0 -lang-c++ %{!no-gcc:-D__GNUG__=%v1}\
         %{fnew-abi:-D__GXX_ABI_VERSION=100}\
         %{ansi:-trigraphs -$ -D__STRICT_ANSI__} %(cpp_options)}\
!      %{!E:%{!M:%{!MM:cc1plus -lang-c++ %{!no-gcc:-D__GNUG__=%v1}\
         %{fnew-abi:-D__GXX_ABI_VERSION=100}\
         %{ansi:-trigraphs -$ -D__STRICT_ANSI__}\
         %(cpp_options) %(cc1_options) %{+e*}\
!        %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\
!      as %(asm_options) %{!pipe:%g.s} %A }}}}}"
  #else /* ! USE_CPPLIB */
      "cpp0 -lang-c++ %{!no-gcc:-D__GNUG__=%v1}\
         %{fnew-abi:-D__GXX_ABI_VERSION=100}\
         %{ansi:-trigraphs -$ -D__STRICT_ANSI__} %(cpp_options)\
         %{!M:%{!MM:%{!E:%{!pipe:%g.ii} |\n\
       cc1plus -lang-c++ %{!pipe:%g.ii} %(cc1_options) %{+e*}\
!      %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\
!      as %(asm_options) %{!pipe:%g.s} %A }}}}}\n"
  #endif /* ! USE_CPPLIB */
    },
    {".ii", "@c++-cpp-output"},
    {"@c++-cpp-output",
     "%{!M:%{!MM:%{!E:\
      cc1plus -lang-c++ -fpreprocessed %i %(cc1_options) %{+e*}\
!     %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\
!     as %(asm_options) %{!pipe:%g.s} %A }}}}}"},
--- 30,60 ----
    {".C",   "@c++"},
    {"@c++",
  #if USE_CPPLIB
+    /* cc1plus has an integrated ISO C preprocessor.  We should invoke
+       the external preprocessor if -save-temps is given.  */
      "%{E|M|MM:cpp0 -lang-c++ %{!no-gcc:-D__GNUG__=%v1}\
         %{fnew-abi:-D__GXX_ABI_VERSION=100}\
         %{ansi:-trigraphs -$ -D__STRICT_ANSI__} %(cpp_options)}\
!      %{!E:%{!M:%{!MM:\
!        %{save-temps:cpp0 -lang-c++ %{ansi:-trigraphs -$ -D__STRICT_ANSI__}\
! 		    %(cpp_options) %b.ii \n}\
!       cc1plus %{save-temps: -fpreprocessed %b.ii} -lang-c++\
!        %{!no-gcc:-D__GNUG__=%v1}\
         %{fnew-abi:-D__GXX_ABI_VERSION=100}\
         %{ansi:-trigraphs -$ -D__STRICT_ANSI__}\
         %(cpp_options) %(cc1_options) %{+e*}\
!        %{!fsyntax-only:%(invoke_as)}}}}"
  #else /* ! USE_CPPLIB */
      "cpp0 -lang-c++ %{!no-gcc:-D__GNUG__=%v1}\
         %{fnew-abi:-D__GXX_ABI_VERSION=100}\
         %{ansi:-trigraphs -$ -D__STRICT_ANSI__} %(cpp_options)\
         %{!M:%{!MM:%{!E:%{!pipe:%g.ii} |\n\
       cc1plus -lang-c++ %{!pipe:%g.ii} %(cc1_options) %{+e*}\
!      %{!fsyntax-only:%(invoke_as)}}}}\n"
  #endif /* ! USE_CPPLIB */
    },
    {".ii", "@c++-cpp-output"},
    {"@c++-cpp-output",
     "%{!M:%{!MM:%{!E:\
      cc1plus -lang-c++ -fpreprocessed %i %(cc1_options) %{+e*}\
!     %{!fsyntax-only:%(invoke_as)}}}}"},
Index: f/lang-specs.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/f/lang-specs.h,v
retrieving revision 1.26
diff -c -p -r1.26 lang-specs.h
*** lang-specs.h	2000/08/21 18:12:36	1.26
--- lang-specs.h	2000/09/24 09:22:17
*************** the Free Software Foundation, 59 Temple 
*** 29,48 ****
    {".FPP", "@f77-cpp-input"},
    {"@f77-cpp-input",
     "tradcpp0 -lang-fortran %(cpp_options) %{!M:%{!MM:%{!E:%{!pipe:%g.f |\n\
!     f771 %{!pipe:%g.f} %(cc1_options) %{I*} %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\
!     as %(asm_options) %{!pipe:%g.s} %A }}}}}}\n"},
    {".r", "@ratfor"},
    {"@ratfor",
     "%{C:%{!E:%eGNU C does not support -C without using -E}}\
      ratfor %{C} %{v} %i %{E:%W{o*}} %{!E: %{!pipe:-o %g.f} |\n\
!     f771 %{!pipe:%g.f} %(cc1_options) %{I*} %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\
!     as %(asm_options) %{!pipe:%g.s} %A }}}\n"},
    {".f",   "@f77"},
    {".for", "@f77"},
    {".FOR", "@f77"},
    {"@f77",
!    "%{!M:%{!MM:%{!E:f771 %i %(cc1_options) %{I*} %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\
!      as %(asm_options) %{!pipe:%g.s} %A }}}}}\n"},
    /* XXX This is perverse and should not be necessary.  */
    {"@f77-version",
     "tradcpp0 -lang-fortran %(cpp_options) %j \n\
--- 29,46 ----
    {".FPP", "@f77-cpp-input"},
    {"@f77-cpp-input",
     "tradcpp0 -lang-fortran %(cpp_options) %{!M:%{!MM:%{!E:%{!pipe:%g.f |\n\
!     f771 %{!pipe:%g.f} %(cc1_options) %{I*} %{!fsyntax-only:%(invoke_as)}}}}}"},
    {".r", "@ratfor"},
    {"@ratfor",
     "%{C:%{!E:%eGNU C does not support -C without using -E}}\
      ratfor %{C} %{v} %i %{E:%W{o*}} %{!E: %{!pipe:-o %g.f} |\n\
!     f771 %{!pipe:%g.f} %(cc1_options) %{I*} %{!fsyntax-only:%(invoke_as)}}"},
    {".f",   "@f77"},
    {".for", "@f77"},
    {".FOR", "@f77"},
    {"@f77",
!    "%{!M:%{!MM:%{!E:f771 %i %(cc1_options) %{I*}\
! 	%{!fsyntax-only:%(invoke_as)}}}}"},
    /* XXX This is perverse and should not be necessary.  */
    {"@f77-version",
     "tradcpp0 -lang-fortran %(cpp_options) %j \n\
Index: java/lang-specs.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/lang-specs.h,v
retrieving revision 1.16
diff -c -p -r1.16 lang-specs.h
*** lang-specs.h	2000/09/06 21:55:39	1.16
--- lang-specs.h	2000/09/24 09:22:17
*************** The Free Software Foundation is independ
*** 33,37 ****
     "%{fjni:%{femit-class-files:%e-fjni and -femit-class-files are incompatible}}\
      %{fjni:%{femit-class-file:%e-fjni and -femit-class-file are incompatible}}\
      %{!E:jc1 %i %(jc1) %(cc1_options) %{+e*} %{I*} %{MD} %{MMD} %{M} %{MM}\
!              %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\
!     as %(asm_options) %{!pipe:%g.s} %A }}}"},
--- 33,37 ----
     "%{fjni:%{femit-class-files:%e-fjni and -femit-class-files are incompatible}}\
      %{fjni:%{femit-class-file:%e-fjni and -femit-class-file are incompatible}}\
      %{!E:jc1 %i %(jc1) %(cc1_options) %{+e*} %{I*} %{MD} %{MMD} %{M} %{MM}\
!              %{!fsyntax-only:%(invoke_as)}}"},
! 
Index: objc/lang-specs.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/objc/lang-specs.h,v
retrieving revision 1.16
diff -c -p -r1.16 lang-specs.h
*** lang-specs.h	2000/09/07 00:37:13	1.16
--- lang-specs.h	2000/09/24 09:22:17
*************** Boston, MA 02111-1307, USA.  */
*** 24,43 ****
    {".m", "@objective-c"},
    {"@objective-c",
  #if USE_CPPLIB
       "%{E|M|MM:%(trad_capable_cpp) -lang-objc %{ansi:-std=c89} %(cpp_options)}\
!       %{!E:%{!M:%{!MM:cc1obj -lang-objc %(cpp_options) %(cc1_options) %{gen-decls}\
!              %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\
!       as %(asm_options) %{!pipe:%g.s} %A }}}}}"
  #else /* ! USE_CPPLIB */
       "%(trad_capable_cpp) -lang-objc %{ansi:-std=c89} %(cpp_options)\
  			  %{!M:%{!MM:%{!E:%{!pipe:%g.mi} |\n\
        cc1obj -lang-objc %{!pipe:%g.mi} %(cc1_options) %{gen-decls}\
! 	     %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\
!       as %(asm_options) %{!pipe:%g.s} %A }}}}}\n"
  #endif /* ! USE_CPPLIB */
      },
    {".mi", "@objc-cpp-output"},
    {"@objc-cpp-output",
       "%{!M:%{!MM:%{!E:cc1obj -lang-objc %i %(cc1_options) %{gen-decls}\
! 			     %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\
!       as %(asm_options) %{!pipe:%g.s} %A }}}}}"},
--- 24,51 ----
    {".m", "@objective-c"},
    {"@objective-c",
  #if USE_CPPLIB
+    /* cc1obj has an integrated ISO C preprocessor.  We should invoke the
+       external preprocessor if -save-temps or -traditional is given.  */
       "%{E|M|MM:%(trad_capable_cpp) -lang-objc %{ansi:-std=c89} %(cpp_options)}\
!       %{!E:%{!M:%{!MM:\
! 	%{save-temps:%(trad_capable_cpp) -lang-objc %{ansi:-std=c89}\
! 	  %(cpp_options) %b.mi \n\
! 	    cc1obj -fpreprocessed %b.mi -lang-objc %(cc1_options) %{gen-decls}}\
! 	%{!save-temps:\
! 	  %{traditional|ftraditional|traditional-cpp:\
! 	    tradcpp0 -lang-objc %{ansi:-std=c89} %(cpp_options) %{!pipe:%g.mi} |\n\
! 	    cc1obj -fpreprocessed %{!pipe:%g.mi} -lang-objc %(cc1_options) %{gen-decls}}\
! 	  %{!traditional:%{!ftraditional:%{!traditional-cpp:\
! 	    cc1obj -lang-objc %{ansi:-std=c89} %(cpp_options) %(cc1_options) %{gen-decls}}}}}\
!         %{!fsyntax-only:%(invoke_as)}}}}"
  #else /* ! USE_CPPLIB */
       "%(trad_capable_cpp) -lang-objc %{ansi:-std=c89} %(cpp_options)\
  			  %{!M:%{!MM:%{!E:%{!pipe:%g.mi} |\n\
        cc1obj -lang-objc %{!pipe:%g.mi} %(cc1_options) %{gen-decls}\
! 	     %{!fsyntax-only:%(invoke_as)}}}}\n"
  #endif /* ! USE_CPPLIB */
      },
    {".mi", "@objc-cpp-output"},
    {"@objc-cpp-output",
       "%{!M:%{!MM:%{!E:cc1obj -lang-objc %i %(cc1_options) %{gen-decls}\
! 			     %{!fsyntax-only:%(invoke_as)}}}}"},


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