]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Remove extra checks for raising a constraint error
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 5 Dec 2024 15:59:36 +0000 (16:59 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 3 Jan 2025 15:39:14 +0000 (16:39 +0100)
Routine Is_OK_Static_Expression itself calls Raises_Constraint_Error, so there
is no need to call both of these routines in a row. Code cleanup; semantics is
unaffected.

gcc/ada/ChangeLog:

* sem_attr.adb (Check_Array_Type): Remove extra call.
* sem_util.adb (Static_Boolean): Likewise.

gcc/ada/sem_attr.adb
gcc/ada/sem_util.adb

index 6eb04b2e2582b153ed5f39ab91c0f89053aab2dc..7295784704fd5f790e068da167d7230cdbeb7b22 100644 (file)
@@ -1994,9 +1994,7 @@ package body Sem_Attr is
             Resolve (E1, Any_Integer);
             Set_Etype (E1, Standard_Integer);
 
-            if not Is_OK_Static_Expression (E1)
-              or else Raises_Constraint_Error (E1)
-            then
+            if not Is_OK_Static_Expression (E1) then
                Flag_Non_Static_Expr
                  ("expression for dimension must be static!", E1);
                Error_Attr;
index bd798d74885cc3ca9e5815fc1f5e76cb9ada4568..c1af2281a22b81be1b6a20bf8a83f0888712b082 100644 (file)
@@ -28232,11 +28232,7 @@ package body Sem_Util is
       end if;
 
       if Is_OK_Static_Expression (N) then
-         if not Raises_Constraint_Error (N) then
-            return Expr_Value (N);
-         else
-            return No_Uint;
-         end if;
+         return Expr_Value (N);
 
       elsif Etype (N) = Any_Type then
          return No_Uint;
@@ -28264,11 +28260,7 @@ package body Sem_Util is
       end if;
 
       if Is_OK_Static_Expression (N) then
-         if not Raises_Constraint_Error (N) then
-            return Expr_Value (N);
-         else
-            return No_Uint;
-         end if;
+         return Expr_Value (N);
 
       elsif Etype (N) = Any_Type then
          return No_Uint;