diff mbox series

[Ada] Restore context on failure in loading of renamed child unit

Message ID 20210708135020.GA2465781@adacore.com
State New
Headers show
Series [Ada] Restore context on failure in loading of renamed child unit | expand

Commit Message

Pierre-Marie de Rodat July 8, 2021, 1:50 p.m. UTC
When loading of renamed child unit failed, we didn't properly restore
the value of a global Parsing_Main_Extended_Source variable.

This is primarily a cleanup change; behaviour is not affected (perhaps
except for errors reported on complicated code that is illegal anyway).

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

gcc/ada/

	* lib-load.adb (Load): Replace early return with goto to properly
	restore context on failure.
diff mbox series

Patch

diff --git a/gcc/ada/lib-load.adb b/gcc/ada/lib-load.adb
--- a/gcc/ada/lib-load.adb
+++ b/gcc/ada/lib-load.adb
@@ -451,8 +451,8 @@  package body Lib.Load is
               With_Node  => With_Node);
 
          if Unump = No_Unit then
-            Parsing_Main_Extended_Source := Save_PMES;
-            return No_Unit;
+            Unum := No_Unit;
+            goto Done;
          end if;
 
          --  If parent is a renaming, then we use the renamed package as