]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Tweak assertions in Inline.Cannot_Inline
authorRonan Desplanques <desplanques@adacore.com>
Wed, 21 Aug 2024 15:22:20 +0000 (17:22 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 5 Sep 2024 08:10:12 +0000 (10:10 +0200)
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.

gcc/ada/inline.adb
gcc/ada/inline.ads

index 519e26ecec8088ed6b6d4104cec944d838875205..5f310abafdaf52fe9121044e9dfbf91a6830a1cb 100644 (file)
@@ -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
index bc90c0ce6d83a16316d4713c50c652c8e8c8d9e7..696f4227c7bf0c44865791a11a5995f7483710be 100644 (file)
@@ -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