public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Fix up handling of ghost units PR104027 #2
@ 2022-01-31 10:47 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-01-31 10:47 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 379 bytes --]

The previous change was short-circuiting too much, the regular
processing (in particular writing ALI files) was bypassed, causing
troubles with e.g. gnatmake or gprbuild down the road.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	PR ada/104027
	* gnat1drv.adb (Gnat1drv): Only call Exit_Program when not
	generating code, otherwise instead go to End_Of_Program.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 969 bytes --]

diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb
--- a/gcc/ada/gnat1drv.adb
+++ b/gcc/ada/gnat1drv.adb
@@ -1504,11 +1504,19 @@ begin
          Namet.Finalize;
          Check_Rep_Info;
 
-         --  Exit the driver with an appropriate status indicator. This will
-         --  generate an empty object file for ignored Ghost units, otherwise
-         --  no object file will be generated.
+         if Ecode /= E_Success then
+            --  If we cannot generate code, exit the driver with an appropriate
+            --  status indicator.
 
-         Exit_Program (Ecode);
+            Exit_Program (Ecode);
+
+         else
+            --  Otherwise use a goto so that finalization occurs normally and
+            --  for instance any late processing in the GCC code can be
+            --  performed.
+
+            goto End_Of_Program;
+         end if;
       end if;
 
       --  In -gnatc mode we only do annotation if -gnatR is also set, or if



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-31 10:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-31 10:47 [Ada] Fix up handling of ghost units PR104027 #2 Pierre-Marie de Rodat

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).