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]
Other format: [Raw text]

Re: [Bug driver/11417] [3.4 regression] fortran options warned about in cc1 when *.F or -x f77-cpp-input


toon at gcc dot gnu dot org wrote:-

> PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11417
> 
> 
> toon at gcc dot gnu dot org changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>          AssignedTo|unassigned at gcc dot gnu   |neil at gcc dot gnu dot org
>                    |dot org                     |
>              Status|NEW                         |ASSIGNED
> 
> 
> ------- Additional Comments From toon at gcc dot gnu dot org  2003-07-04 17:28 -------
> This must be Neil's doing.

Sadly there isn't a clean and simple solution to this, since the real
problem is the driver passing down switches to cc1 that apply to
Fortran.  This is the best I can think of.

Neil.

	PR driver/11417
	* c-opts.c (permit_fortran_options): New.
	(c_common_init_options): Accept fortran front end options if
	it looks like we might be preprocessing Fortran.
	(c_common_handle_option): Don't reject switch if permit_fotran_options.

Index: c-opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-opts.c,v
retrieving revision 1.67
diff -u -p -r1.67 c-opts.c
--- c-opts.c	3 Jul 2003 23:17:52 -0000	1.67
+++ c-opts.c	4 Jul 2003 22:35:28 -0000
@@ -98,6 +98,9 @@ static size_t deferred_count;
 /* Number of deferred options scanned for -include.  */
 static size_t include_cursor;
 
+/* Permit Fotran front-end options.  */
+static bool permit_fortran_options;
+
 void missing_arg (enum opt_code);
 static void set_Wimplicit (int);
 static void print_help (void);
@@ -201,6 +204,7 @@ unsigned int
 c_common_init_options (unsigned int argc, const char **argv ATTRIBUTE_UNUSED)
 {
   static const unsigned int lang_flags[] = {CL_C, CL_ObjC, CL_CXX, CL_ObjCXX};
+  unsigned int result;
 
   /* This is conditionalized only because that is the way the front
      ends used to do it.  Maybe this should be unconditional?  */
@@ -232,7 +236,20 @@ c_common_init_options (unsigned int argc
   deferred_opts = (struct deferred_opt *)
     xmalloc (argc * sizeof (struct deferred_opt));
 
-  return lang_flags[c_language];
+  result = lang_flags[c_language];
+
+  /* If potentially preprocessing Fortran we have to accept its front
+     end options since the driver passes most of them through.  */
+#ifdef CL_F77
+  if (c_language == clk_c && argc > 2
+      && !strcmp (argv[2], "-traditional-cpp" ))
+    {
+      permit_fortran_options = true;
+      result |= CL_F77;
+    }
+#endif
+
+  return result;
 }
 
 /* Handle switch SCODE with argument ARG.  ON is true, unless no-
@@ -261,7 +278,8 @@ c_common_handle_option (size_t scode, co
   switch (code)
     {
     default:
-      return 0;
+      result = permit_fortran_options;
+      break;
 
     case OPT__help:
       print_help ();


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