From d9a51b704fe521fecb2e77931226c8e8798a9910 Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Thu, 5 Dec 2024 16:59:36 +0100 Subject: 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. --- gcc/ada/sem_attr.adb | 4 +--- gcc/ada/sem_util.adb | 12 ++---------- 2 files changed, 3 insertions(+), 13 deletions(-) (limited to 'gcc') diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 6eb04b2..7295784 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 bd798d7..c1af228 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; -- cgit v1.1