[FYI,Ada] reenable ada83 library unit renaming error

Message ID orpms8jjrg.fsf@lxoliva.fsfla.org
State New
Headers show
  • [FYI,Ada] reenable ada83 library unit renaming error
Related show

Commit Message

Xionghu Luo via Gcc-patches Oct. 14, 2021, 4:46 a.m.
The condition of the 'if' encompassed that of the 'elsif', so the error
message wouldn't get a chance to be printed.

Regstrapped on x86_64-linux-gnu.  I'm checking this in.

for  gcc/ada/ChangeLog

	* par-ch10.adb (P_Compilation_Unit): Reenable ada83 library
	unit renaming test and error.
 gcc/ada/par-ch10.adb |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>


diff --git a/gcc/ada/par-ch10.adb b/gcc/ada/par-ch10.adb
index f02934afc7e44..76f0edddc94c6 100644
--- a/gcc/ada/par-ch10.adb
+++ b/gcc/ada/par-ch10.adb
@@ -532,13 +532,14 @@  package body Ch10 is
                                | N_Subprogram_Body
                                | N_Subprogram_Renaming_Declaration
-            Unit_Node := Specification (Unit_Node);
-         elsif Nkind (Unit_Node) = N_Subprogram_Renaming_Declaration then
-            if Ada_Version = Ada_83 then
+            if Nkind (Unit_Node) = N_Subprogram_Renaming_Declaration
+              and then Ada_Version = Ada_83
+            then
                  ("(Ada 83) library unit renaming not allowed", Unit_Node);
             end if;
+            Unit_Node := Specification (Unit_Node);
          end if;
          if Nkind (Unit_Node) in N_Task_Body