diff mbox series

[COMMITTED,1/6] ada: Tweak assertions in Inline.Cannot_Inline

Message ID 20240905081056.2402112-1-poulhies@adacore.com
State New
Headers show
Series [COMMITTED,1/6] ada: Tweak assertions in Inline.Cannot_Inline | expand

Commit Message

Marc Poulhiès Sept. 5, 2024, 8:10 a.m. UTC
From: Ronan Desplanques <desplanques@adacore.com>

The purpose of this patch is to silence a GNATSAS report.

gcc/ada/

	* inline.adb (Cannot_Inline): Remove assertion.
	* inline.ads (Cannot_Inline): Add precondition.

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

---
 gcc/ada/inline.adb | 2 --
 gcc/ada/inline.ads | 5 ++++-
 2 files changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb
index 519e26ecec8..5f310abafda 100644
--- a/gcc/ada/inline.adb
+++ b/gcc/ada/inline.adb
@@ -2136,8 +2136,6 @@  package body Inline is
          end;
       end if;
 
-      pragma Assert (Msg (Msg'Last) = '?');
-
       --  Legacy front-end inlining model
 
       if not Back_End_Inlining then
diff --git a/gcc/ada/inline.ads b/gcc/ada/inline.ads
index bc90c0ce6d8..696f4227c7b 100644
--- a/gcc/ada/inline.ads
+++ b/gcc/ada/inline.ads
@@ -165,7 +165,10 @@  package Inline is
       N             : Node_Id;
       Subp          : Entity_Id;
       Is_Serious    : Boolean := False;
-      Suppress_Info : Boolean := False);
+      Suppress_Info : Boolean := False)
+     with
+       Pre => Msg'First <= Msg'Last
+       and then Msg (Msg'Last) = '?';
    --  This procedure is called if the node N, an instance of a call to
    --  subprogram Subp, cannot be inlined. Msg is the message to be issued,
    --  which ends with ? (it does not end with ?p?, this routine takes care of