From: Piotr Trojanek Date: Thu, 5 Dec 2024 15:59:36 +0000 (+0100) Subject: ada: Remove extra checks for raising a constraint error X-Git-Tag: basepoints/gcc-16~3013 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d9a51b704fe521fecb2e77931226c8e8798a9910;p=thirdparty%2Fgcc.git ada: Remove extra checks for raising a constraint error 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. --- diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 6eb04b2e2582..7295784704fd 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -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; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index bd798d74885c..c1af2281a22b 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -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;