]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Tune detection of expression functions within a declare expression
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 1 Feb 2023 19:41:49 +0000 (20:41 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 26 May 2023 07:29:17 +0000 (09:29 +0200)
Code cleanup; semantics is unaffected.

gcc/ada/

* sem_ch4.adb (Check_Action_OK): Replace low-level test with a
high-level routine.
* sem_ch13.adb (Is_Predicate_Static): Likewise.

gcc/ada/sem_ch13.adb
gcc/ada/sem_ch4.adb

index b13af26b561f828b1e66adfa4700776b77dcb4cc..958b26ebb0d2b9caee91b196e73779101b4d5120 100644 (file)
@@ -14261,7 +14261,7 @@ package body Sem_Ch13 is
       --   transformed into just "(S /= 0)", which would appear to be
       --   a predicate-static expression (and therefore legal).
 
-      if Original_Node (Expr) /= Expr then
+      if Is_Rewrite_Substitution (Expr) then
 
          --  Emit warnings for predicates that are always True or always False
          --  and were not originally expressed as Boolean literals.
index a85c988fe4656b2617961a67c074891e122c31dd..c8bb99b671654245c09c2d79e2b94f957788c63c 100644 (file)
@@ -2371,11 +2371,11 @@ package body Sem_Ch4 is
          if not Comes_From_Source (N) or else not Comes_From_Source (A) then
 
             --  If, for example, an (illegal) expression function is
-            --  transformed into a"vanilla" function then we don't want to
+            --  transformed into a "vanilla" function then we don't want to
             --  allow it just because Comes_From_Source is now False. So look
             --  at the Original_Node.
 
-            if A /= Original_Node (A) then
+            if Is_Rewrite_Substitution (A) then
                Check_Action_OK (Original_Node (A));
             end if;