public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] ada: Fix detection of (Un)Hide_Info pragma in GNATprove mode
@ 2024-05-06  9:18 Marc Poulhiès
  0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2024-05-06  9:18 UTC (permalink / raw)
  To: gcc-patches; +Cc: Yannick Moy

From: Yannick Moy <moy@adacore.com>

Spec or body may not be in a list for subunit.

gcc/ada/

	* inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Add guard.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/inline.adb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb
index 98bed860760..b7a6cc90cd2 100644
--- a/gcc/ada/inline.adb
+++ b/gcc/ada/inline.adb
@@ -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;
-- 
2.43.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-06  9:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-06  9:18 [COMMITTED] ada: Fix detection of (Un)Hide_Info pragma in GNATprove mode Marc Poulhiès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).