]> gcc.gnu.org Git - gcc.git/commitdiff
ada: Fix detection of (Un)Hide_Info pragma in GNATprove mode
authorYannick Moy <moy@adacore.com>
Tue, 19 Dec 2023 09:52:38 +0000 (10:52 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 6 May 2024 09:11:27 +0000 (11:11 +0200)
Spec or body may not be in a list for subunit.

gcc/ada/

* inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Add guard.

gcc/ada/inline.adb

index 98bed860760968c67d61d299bb8675346b0a325d..b7a6cc90cd2620f2865c7d27b56547a1dde8cf81 100644 (file)
@@ -1819,6 +1819,7 @@ package body Inline is
 
       begin
          if Present (Spec_Id)
+           and then Is_List_Member (Unit_Declaration_Node (Spec_Id))
            and then Has_Hide_Unhide_Pragma
              (Next (Unit_Declaration_Node (Spec_Id)))
          then
@@ -1829,7 +1830,9 @@ package body Inline is
                Subp_Body : constant N_Subprogram_Body_Id :=
                  Unit_Declaration_Node (Body_Id);
             begin
-               return Has_Hide_Unhide_Pragma (Next (Subp_Body))
+               return
+                 (Is_List_Member (Subp_Body)
+                   and then Has_Hide_Unhide_Pragma (Next (Subp_Body)))
                  or else
                    Has_Hide_Unhide_Pragma (First (Declarations (Subp_Body)));
             end;
This page took 0.20097 seconds and 5 git commands to generate.