]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix spurious warning on Inline_Always and contracts
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 6 Feb 2023 13:40:26 +0000 (14:40 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 22 May 2023 08:44:09 +0000 (10:44 +0200)
Warnings about pre/postconditions being ignored with Inline_Always were
only true for the obsolete frontend inlining. With the current backend
pre/postconditions work fine with Inline_Always.

gcc/ada/

* sem_prag.adb (Check_Postcondition_Use_In_Inlined_Subprogram): Only
emit warning when frontend inlining is enabled.

gcc/ada/sem_prag.adb

index b6c78dbd559b714554b529c371ce5848dd8cd40b..dbc8584e211732f47b76d2ca5092fcf3fb786414 100644 (file)
@@ -210,7 +210,7 @@ package body Sem_Prag is
    --  Subsidiary to the analysis of pragmas Contract_Cases, Postcondition,
    --  Precondition, Refined_Post, and Test_Case. Emit a warning when pragma
    --  Prag is associated with subprogram Spec_Id subject to Inline_Always,
-   --  and assertions are enabled.
+   --  assertions are enabled and inling is done in the frontend.
 
    procedure Check_State_And_Constituent_Use
      (States   : Elist_Id;
@@ -30304,6 +30304,7 @@ package body Sem_Prag is
       if Warn_On_Redundant_Constructs
         and then Has_Pragma_Inline_Always (Spec_Id)
         and then Assertions_Enabled
+        and then not Back_End_Inlining
       then
          Error_Msg_Name_1 := Original_Aspect_Pragma_Name (Prag);