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

Re: target/4789: [DJGPP] preprocessing fortran files by cpp with extension .f


On Tuesday 08 January 2002 20:42, Neil Booth wrote:
> Andris Pavenis wrote:-
>
> > The problem appears when -remap is used in specs in cpp_options.
> > cpp_options settings are common for both tradcpp0 and cpp0. For DJGPP we
> > need -remap to avoid need to use changed names of include files (DJGPP
> > can be used under plain MS-DOS when we only have 8+3 filename
> > limitations). -remap is not recognized by tradcpp0 as valid option.
> > Unfortunatelly tradcpp0 and cpp0 are used also directly in specs not only
> > through trad_capable_cpp (otherwise I could change there)
>
> Are you saying that getting tradcpp to recognize and ignore -remap
> would fix it?  Or does tradcpp require a -remap implementation?

The best would be of course the real implementation of -remap in tradcpp0.
However I think even ignoring it silently in tradcpp0 could be Ok at least now

C : option -traditional is unusable for DJGPP as header files are incompatible with it, 
so no additional harm from silently ignoring this option in tradcpp0

C++ :  doesn't use tradcpp0 as far as I looked and I really used -remap
to workaround filename conflicts for libstdc++ header files under plain DOS.

Fortran: here we have some trouble as for FORTRAN tradcpp0 is used 
unconditionally. However there should be no harm from ignoring -remap unless user 
explicitly tries to remap file names to be included
 
So I think it would be sufficient to ignore -remap in tradcpp0 now and add 
FIXME note there, to remaind about that, so maybe somebody could add support
in future

>
> > I tried to fix that for DJGPP port of gcc-3.0.3, but it required to
> > add options specially for cpp0 only (not for tradcpp0) and to use
> > this new spec where needed (in cp/lang-specs.h and f/lang-specs.h,
> > gcc.c, etc)
>
> What exactly did you do?
>

I added cpp0_only_options and used this spec where needed. I'm including diffs
against trunk for common files (except DJGPP target related ones). Unfortunatelly 
I haven't write update for documentation ...

There could be some shift in diffs as I removed unrelated changes for gcc.c with text editor

Andris

--- gcc.c.orig	Thu Jan  3 04:01:24 2002
+++ gcc.c	Mon Jan  7 14:06:44 2002
@@ -531,6 +538,11 @@
 #define CPP_SPEC ""
 #endif
 
+/* This is for preprocessor options which don't work with tradcpp0  */
+#ifndef CPP0_ONLY_OPTIONS
+#define CPP0_ONLY_OPTIONS ""
+#endif
+
 /* config.h can define CC1_SPEC to provide extra args to cc1 and cc1plus
    or extra switch-translations.  */
 #ifndef CC1_SPEC
@@ -663,6 +675,7 @@
 static const char *linker_name_spec = LINKER_NAME;
 static const char *link_command_spec = LINK_COMMAND_SPEC;
 static const char *link_libgcc_spec = LINK_LIBGCC_SPEC;
+static const char *cpp0_only_options = CPP0_ONLY_OPTIONS;
 
 /* Standard options to cpp, cc1, and as, to reduce duplication in specs.
    There should be no need to override these in target dependent files,
@@ -671,7 +684,8 @@
    appropriate -B options.  */
 
 static const char *trad_capable_cpp =
-"%{traditional|ftraditional|traditional-cpp:trad}cpp0";
+"%{traditional|ftraditional|traditional-cpp:trad}cpp0 \
+ %{!traditional:%{!ftraditional:%{!traditional-cpp:%(cpp0_only_options)}}}";
 
 static const char *cpp_options =
 "%{C:%{!E:%eGNU C does not support -C without using -E}}\
@@ -840,7 +854,8 @@
 		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)}}}}\
+		cc1 -lang-c %{ansi:-std=c89} %(cpp0_only_options) %(cpp_options) \
+		    %(cc1_options)}}}}\
         %{!fsyntax-only:%(invoke_as)}}}}", 0},
   {"-",
    "%{!E:%e-E required when input is from standard input}\
@@ -1369,6 +1389,7 @@
   INIT_STATIC_SPEC ("cpp",			&cpp_spec),
   INIT_STATIC_SPEC ("cpp_options",		&cpp_options),
   INIT_STATIC_SPEC ("trad_capable_cpp",		&trad_capable_cpp),
+  INIT_STATIC_SPEC ("cpp0_only_options", 	&cpp0_only_options),
   INIT_STATIC_SPEC ("cc1",			&cc1_spec),
   INIT_STATIC_SPEC ("cc1_options",		&cc1_options),
   INIT_STATIC_SPEC ("cc1plus",			&cc1plus_spec),
--- cp/lang-specs.h.orig	Sat Jul 21 04:00:44 2001
+++ cp/lang-specs.h	Thu Dec  6 13:52:02 2001
@@ -39,7 +39,8 @@
        %{!Wno-deprecated:-D__DEPRECATED}\
        %{!fno-exceptions:-D__EXCEPTIONS}\
        -D__GXX_ABI_VERSION=100\
-       %{ansi:-D__STRICT_ANSI__ -trigraphs -$} %(cpp_options)}\
+       %{ansi:-D__STRICT_ANSI__ -trigraphs -$} %(cpp0_only_options) \
+       %(cpp_options)}\
      %{!E:%{!M:%{!MM:\
        %{save-temps:cpp0 -lang-c++ \
 		    %{!no-gcc:-D__GNUG__=%v1}\
@@ -47,9 +48,9 @@
 		    %{!fno-exceptions:-D__EXCEPTIONS}\
 		    -D__GXX_ABI_VERSION=100\
 		    %{ansi:-D__STRICT_ANSI__ -trigraphs -$}\
-		    %(cpp_options) %b.ii \n}\
+		     %(cpp0_only_options) %(cpp_options) %b.ii \n}\
       cc1plus %{save-temps:-fpreprocessed %b.ii}\
-              %{!save-temps:%(cpp_options)\
+              %{!save-temps: %(cpp0_only_options) %(cpp_options)\
 			    %{!no-gcc:-D__GNUG__=%v1} \
        			    %{!Wno-deprecated:-D__DEPRECATED}\
 			    %{!fno-exceptions:-D__EXCEPTIONS}\


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