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]

[Patch] for PR 28528: C language extensions override -x in C++ driver


The problem is that g++ lang driver is failing to swallow the 'lang-arg'
to "-x lang-arg" option in the case when it delimited by a space. This
fixes by always check on what follows '-x' and setting 'quote' if
appropriate. Also, we were emitting .gch files even when -fsyntax-only
was specified. That is inconsistent with other usages of -fsyntax-only.

OK? Bootstrapped and tested on i686-pc-mingw32 with no new regressions.

:ADDPATCH driver:

cp/ChangeLog

	PR driver/28528
	* g++spec.c (lang_specific_driver): Always check if we need to
	swallow a space-separated  arg to '-x'.
	*lang-specs.h:  Don't create ouput files for '-xc++-header'
	if -fsyntax-only.  


Index: g++spec.c
===================================================================
--- g++spec.c	(revision 116312)
+++ g++spec.c	(working copy)
@@ -149,19 +149,19 @@
 	    saw_verbose_flag = 1;
 	  else if (strncmp (argv[i], "-x", 2) == 0)
 	    {
-	      if (library == 0)
-		{
-		  const char * arg;
-		  if (argv[i][2] != '\0')
-		    arg = argv[i]+2;
-		  else if (argv[i+1] != NULL)
-		    arg = argv[i+1];
-		  else  /* Error condition, message will be printed
later.  */
-		    arg = "";
-		  if (strcmp (arg, "c++") == 0
-		      || strcmp (arg, "c++-cpp-output") == 0)
-		    library = 1;
-		}
+	      const char * arg;
+	      if (argv[i][2] != '\0')
+		arg = argv[i]+2;
+	      else if ((argv[i+1]) != NULL)
+		/* We need to swallow arg on next loop.  */
+		quote = arg =  argv[i+1];
+  	      else  /* Error condition, message will be printed later.
*/
+		arg = "";
+	      if (library == 0
+		  && (strcmp (arg, "c++") == 0
+		      || strcmp (arg, "c++-cpp-output") == 0))
+		library = 1;
+		
 	      saw_speclang = 1;
 	    }
 	  /* Arguments that go directly to the linker might be .o files,
Index: lang-specs.h
===================================================================
--- lang-specs.h	(revision 116312)
+++ lang-specs.h	(working copy)
@@ -43,7 +43,7 @@
       cc1plus %{save-temps|no-integrated-cpp:-fpreprocessed
%{save-temps:%b.ii} %{!save-temps:%g.ii}}\
 
%{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options)}}\
 	%(cc1_options) %2 %{+e1*}\
-	-o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}",
+	%{!fsyntax-only:-o %g.s %{!o*:--output-pch=%i.gch}
%W{o*:--output-pch=%*}%V}}}}",
      CPLUSPLUS_CPP_SPEC, 0, 0},
   {"@c++",
     "%{E|M|MM:cc1plus -E %(cpp_options) %2 %(cpp_debug_options)}\


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