From: Arnaud Charlet Date: Mon, 24 Jan 2022 19:16:27 +0000 (-0500) Subject: [Ada] Fix up handling of ghost units PR104027 #2 X-Git-Tag: basepoints/gcc-13~1370 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2dbc237e8605bb87f8b25adc455436dcba41fce8;p=thirdparty%2Fgcc.git [Ada] Fix up handling of ghost units PR104027 #2 gcc/ada/ PR ada/104027 * gnat1drv.adb (Gnat1drv): Only call Exit_Program when not generating code, otherwise instead go to End_Of_Program. --- diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb index f50feb2905db..f85bc13414cb 100644 --- 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