]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Disable checking of Elab_Spec procedures in CodePeer_Mode
authorGhjuvan Lacambre <lacambre@adacore.com>
Fri, 18 Nov 2022 15:05:12 +0000 (16:05 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 22 Nov 2022 12:34:51 +0000 (13:34 +0100)
This commit re-enables the Validate_Subprogram_Calls check that had been
disabled in a previous commit and has said check skip over Elab_Spec
procedures in CodePeer_Mode.

gcc/ada/

* frontend.adb (Frontend): Re-enable Validate_Subprogram_Calls.
* exp_ch6.adb (Check_BIP_Actuals): When in CodePeer mode, do not
attempt to validate procedures coming from an
Elab_Spec/Elab_Body/Elab_Subp_Body procedure.

gcc/ada/exp_ch6.adb
gcc/ada/frontend.adb

index a5dee38c55f71abbc941cbd07c7fa5ac9954c8a7..237a19d1327e36566ad4961372c9afb039170bd6 100644 (file)
@@ -1115,6 +1115,23 @@ package body Exp_Ch6 is
                                         | N_Function_Call
                                         | N_Procedure_Call_Statement);
 
+      --  In CodePeer_Mode, the tree for `'Elab_Spec` procedures will be
+      --  malformed because GNAT does not perform the usual expansion that
+      --  results in the importation of external elaboration procedure symbols.
+      --  This is expected: the CodePeer backend has special handling for this
+      --  malformed tree.
+      --  Thus, we do not need to check the tree (and in fact can't, because
+      --  it's malformed).
+
+      if CodePeer_Mode
+        and then Nkind (Name (Subp_Call)) = N_Attribute_Reference
+        and then Attribute_Name (Name (Subp_Call)) in Name_Elab_Spec
+                                                    | Name_Elab_Body
+                                                    | Name_Elab_Subp_Body
+      then
+         return True;
+      end if;
+
       Formal := First_Formal_With_Extras (Subp_Id);
       Actual := First_Actual (Subp_Call);
 
index bc3da30b0cf27e9bd1f97df30d1e699f42610d08..033ecf3b7be750620451bcabb5e6d8a9f5e497fb 100644 (file)
@@ -531,7 +531,7 @@ begin
    --  formals). It is invoked using pragma Debug to avoid adding any cost
    --  when the compiler is built with assertions disabled.
 
-   if not Debug_Flag_Underscore_XX and then not CodePeer_Mode then
+   if not Debug_Flag_Underscore_XX then
       pragma Debug (Exp_Ch6.Validate_Subprogram_Calls (Cunit (Main_Unit)));
    end if;