diff mbox

[driver] try to fix "driver specifies output file twice" bug

Message ID CADNgcEwYA2_ekXhjH_BXwXcHxsL+0z8gYFwbFCaZ-2i5M-Kp=w@mail.gmail.com
State New
Headers show

Commit Message

Mingjie Xing Nov. 5, 2013, 9 a.m. UTC
Hello,

This patch is trying to fix the bug (driver specifies output file
twice when compiling header with -S)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31316.

Changes:

        * gcc.c (default_compilers): Update c-header specs.

By applying the patch, run command

$ gcc -S foo.h

will just output an assembly file foo.s.

$ gcc -fsyntax-only foo.h

no output file.

$ gcc foo.h -o foo.s

will output PCH file named foo.s.

$ gcc foo.h -save-temps

will output foo.i, foo.s, foo.h.gch.

But,

$ gcc foo.h -save-temps -o foo.s

will output foo.s, a mix of assembly and PCH.  This should be fixed.

Any suggestions?

Thanks,
Mingjie
diff mbox

Patch

Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c	(revision 204285)
+++ gcc/gcc.c	(working copy)
@@ -1048,14 +1048,15 @@  static const struct compiler default_com
       %{!E:%{!M:%{!MM:\
 	  %{save-temps*|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \
 		%(cpp_options) -o %{save-temps*:%b.i} %{!save-temps*:%g.i} \n\
-		    cc1 -fpreprocessed %{save-temps*:%b.i} %{!save-temps*:%g.i} \
-			%(cc1_options)\
-                        %{!fdump-ada-spec*:-o %g.s %{!o*:--output-pch=%i.gch}\
-                        %W{o*:--output-pch=%*}}%V}\
+		cc1 -fpreprocessed %{save-temps*:%b.i} %{!save-temps*:%g.i} \
+		    %(cc1_options)\
+		    %{!fsyntax-only:%{!S:%{!fdump-ada-spec*:-o %g.s \
+			%{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}}}}%V}\
 	  %{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\
 		cc1 %(cpp_unique_options) %(cc1_options)\
-                    %{!fdump-ada-spec*:-o %g.s %{!o*:--output-pch=%i.gch}\
-                    %W{o*:--output-pch=%*}}%V}}}}}}", 0, 0, 0},
+		    %{!fsyntax-only:%{!S:%{!fdump-ada-spec*:-o %g.s \
+			%{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}}}}%V}}}\
+				}}}", 0, 0, 0},
   {".i", "@cpp-output", 0, 0, 0},
   {"@cpp-output",
    "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},