diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2020-11-23 23:52:59 +0100 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-12-15 06:41:52 -0500 |
commit | 9c852dfb057c645e1dc1e29115e57062b878bdc5 (patch) | |
tree | c9a0ba4392c21a2017d448193588b6f68e1b231e /gcc | |
parent | 10853d6e8a0cc92f2dcf2a396db9ae73f75b5abc (diff) | |
download | gcc-9c852dfb057c645e1dc1e29115e57062b878bdc5.zip gcc-9c852dfb057c645e1dc1e29115e57062b878bdc5.tar.gz gcc-9c852dfb057c645e1dc1e29115e57062b878bdc5.tar.bz2 |
[Ada] Remove redundant calls to UI_To_Int in relational operands
gcc/ada/
* exp_disp.adb (Make_Tags): Remove call to UI_To_Int.
* sem_attr.adb (Check_Array_Type): Likewise; also, refine type
of a local variable.
(Analyze_Attribute): Likewise.
(Get_Enclosing_Object): Likewise.
* sem_util.adb (Get_Enum_Lit_From_Pos): Likewise.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/exp_disp.adb | 2 | ||||
-rw-r--r-- | gcc/ada/sem_attr.adb | 8 | ||||
-rw-r--r-- | gcc/ada/sem_util.adb | 2 |
3 files changed, 5 insertions, 7 deletions
diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb index 1a41d79..14f25db 100644 --- a/gcc/ada/exp_disp.adb +++ b/gcc/ada/exp_disp.adb @@ -7241,7 +7241,7 @@ package body Exp_Disp is -- is used by Build_Get_Prim_Op_Address to expand dispatching calls -- through the primary dispatch table. - if UI_To_Int (DT_Entry_Count (First_Tag_Component (Typ))) = 0 then + if DT_Entry_Count (First_Tag_Component (Typ)) = 0 then Analyze_List (Result); -- Generate: diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 537da93..58cb92f 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -1656,7 +1656,7 @@ package body Sem_Attr is ---------------------- procedure Check_Array_Type is - D : Int; + D : Pos; -- Dimension number for array attributes begin @@ -1741,9 +1741,7 @@ package body Sem_Attr is ("expression for dimension must be static!", E1); Error_Attr; - elsif UI_To_Int (Expr_Value (E1)) > D - or else UI_To_Int (Expr_Value (E1)) < 1 - then + elsif Expr_Value (E1) > D or else Expr_Value (E1) < 1 then Error_Attr ("invalid dimension number for array type", E1); end if; end if; @@ -4838,7 +4836,7 @@ package body Sem_Attr is Error_Attr; elsif UI_To_Int (Intval (E1)) > Number_Formals (Entity (P)) - or else UI_To_Int (Intval (E1)) < 0 + or else Intval (E1) < 0 then Error_Attr ("invalid parameter number for % attribute", E1); end if; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 30d4457..063860a 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -10553,7 +10553,7 @@ package body Sem_Util is -- Position in the enumeration type starts at 0 - if UI_To_Int (Pos) < 0 then + if Pos < 0 then raise Constraint_Error; end if; |