public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix driver/33980: Precompiled header file not removed on error
@ 2023-05-19 14:48 Andrew Pinski
  2023-05-19 17:32 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Pinski @ 2023-05-19 14:48 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andrew Pinski

So the problem here is that in the spec files, we were not marking the pch
output file to be removed on error.
The way to fix this is to mark the --output-pch argument as the output
file argument.
For the C++ specs file, we had to move around where the %V was located
such that it would be after the %w marker as %V marker clears the outputfiles.

OK? Bootstrapped and tested on x86_64-linux-gnu.

gcc/cp/ChangeLog:

	PR driver/33980
	* lang-specs.h ("@c++-header"): Add %w after
	the --output-pch.
	("@c++-system-header"): Likewise.
	("@c++-user-header"): Likewise.

gcc/ChangeLog:

	PR driver/33980
	* gcc.cc (default_compilers["@c-header"]): Add %w
	after the --output-pch.
---
 gcc/cp/lang-specs.h | 12 ++++++------
 gcc/gcc.cc          |  8 ++++----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
index c591d155cc1..94bdd4dcc4a 100644
--- a/gcc/cp/lang-specs.h
+++ b/gcc/cp/lang-specs.h
@@ -53,9 +53,9 @@ along with GCC; see the file COPYING3.  If not see
       "  %{fmodules-ts:-fmodule-header %{fpreprocessed:-fdirectives-only}}"
       "  %(cc1_options) %2"
       "  %{!fsyntax-only:"
-      "    %{!S:-o %g.s%V}"
+      "    %{!S:-o %g.s}"
       "    %{!fmodule-*:%{!fmodules-*:%{!fdump-ada-spec*:"
-      "	         %{!o*:--output-pch %i.gch}%W{o*:--output-pch %*}}}}}"
+      "	         %{!o*:--output-pch %w%i.gch}%W{o*:--output-pch %w%*}}}}%{!S:%V}}"
       "}}}",
      CPLUSPLUS_CPP_SPEC, 0, 0},
   {"@c++-system-header",
@@ -74,9 +74,9 @@ along with GCC; see the file COPYING3.  If not see
       "    %{fpreprocessed:-fdirectives-only}}"
       "  %(cc1_options) %2"
       "  %{!fsyntax-only:"
-      "    %{!S:-o %g.s%V}"
+      "    %{!S:-o %g.s}"
       "    %{!fmodule-*:%{!fmodules-*:%{!fdump-ada-spec*:"
-      "	         %{!o*:--output-pch %i.gch}%W{o*:--output-pch %*}}}}}"
+      "	         %{!o*:--output-pch %w%i.gch}%W{o*:--output-pch %w%*}}}}%{!S:%V}}"
       "}}}",
      CPLUSPLUS_CPP_SPEC, 0, 0},
   {"@c++-user-header",
@@ -94,9 +94,9 @@ along with GCC; see the file COPYING3.  If not see
       "  %{fmodules-ts:-fmodule-header=user %{fpreprocessed:-fdirectives-only}}"
       "  %(cc1_options) %2"
       "  %{!fsyntax-only:"
-      "    %{!S:-o %g.s%V}"
+      "    %{!S:-o %g.s}"
       "    %{!fmodule-*:%{!fmodules-*:%{!fdump-ada-spec*:"
-      "	         %{!o*:--output-pch %i.gch}%W{o*:--output-pch %*}}}}}"
+      "	         %{!o*:--output-pch %w%i.gch}%W{o*:--output-pch %w%*}}}}%{!S:%V}}"
       "}}}",
      CPLUSPLUS_CPP_SPEC, 0, 0},
   {"@c++",
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 39a44fa486d..2ccca00d603 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1454,13 +1454,13 @@ static const struct compiler default_compilers[] =
 		    cc1 -fpreprocessed %{save-temps*:%b.i} %{!save-temps*:%g.i} \
 			%(cc1_options)\
 			%{!fsyntax-only:%{!S:-o %g.s} \
-			    %{!fdump-ada-spec*:%{!o*:--output-pch %i.gch}\
-					       %W{o*:--output-pch %*}}%V}}\
+			    %{!fdump-ada-spec*:%{!o*:--output-pch %w%i.gch}\
+					       %W{o*:--output-pch %w%*}}%{!S:%V}}}\
 	  %{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\
 		cc1 %(cpp_unique_options) %(cc1_options)\
 		    %{!fsyntax-only:%{!S:-o %g.s} \
-		        %{!fdump-ada-spec*:%{!o*:--output-pch %i.gch}\
-					   %W{o*:--output-pch %*}}%V}}}}}}}", 0, 0, 0},
+		        %{!fdump-ada-spec*:%{!o*:--output-pch %w%i.gch}\
+					   %W{o*:--output-pch %w%*}}%{!S:%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},
-- 
2.31.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix driver/33980: Precompiled header file not removed on error
  2023-05-19 14:48 [PATCH] Fix driver/33980: Precompiled header file not removed on error Andrew Pinski
@ 2023-05-19 17:32 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2023-05-19 17:32 UTC (permalink / raw)
  To: Andrew Pinski, gcc-patches



On 5/19/23 08:48, Andrew Pinski via Gcc-patches wrote:
> So the problem here is that in the spec files, we were not marking the pch
> output file to be removed on error.
> The way to fix this is to mark the --output-pch argument as the output
> file argument.
> For the C++ specs file, we had to move around where the %V was located
> such that it would be after the %w marker as %V marker clears the outputfiles.
> 
> OK? Bootstrapped and tested on x86_64-linux-gnu.
> 
> gcc/cp/ChangeLog:
> 
> 	PR driver/33980
> 	* lang-specs.h ("@c++-header"): Add %w after
> 	the --output-pch.
> 	("@c++-system-header"): Likewise.
> 	("@c++-user-header"): Likewise.
> 
> gcc/ChangeLog:
> 
> 	PR driver/33980
> 	* gcc.cc (default_compilers["@c-header"]): Add %w
> 	after the --output-pch.
OK
jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-19 17:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-19 14:48 [PATCH] Fix driver/33980: Precompiled header file not removed on error Andrew Pinski
2023-05-19 17:32 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).