aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2024-08-08 10:59:57 +0200
committerMarc Poulhiès <dkm@gcc.gnu.org>2024-09-02 10:22:49 +0200
commit78acc6d85f972102b92e803bef0aac0afdb1ca9e (patch)
tree68b100c982f21610451073d26c3910bd60ae6a08 /gcc
parent25d51fb7d098a9ac8880ccb2121d889815680177 (diff)
downloadgcc-78acc6d85f972102b92e803bef0aac0afdb1ca9e.zip
gcc-78acc6d85f972102b92e803bef0aac0afdb1ca9e.tar.gz
gcc-78acc6d85f972102b92e803bef0aac0afdb1ca9e.tar.bz2
ada: Remove repeated guards in validity checks
Routine Insert_Valid_Check only applies checks when Expr_Known_Valid query returns False; there is no need to call this query before inserting checks. Code cleanup; behavior is unaffected. gcc/ada/ * exp_imgv.adb (Expand_User_Defined_Enumeration_Image) (Expand_Image_Attribute): Remove redundant guards.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/exp_imgv.adb8
1 files changed, 2 insertions, 6 deletions
diff --git a/gcc/ada/exp_imgv.adb b/gcc/ada/exp_imgv.adb
index e5d84cc..ce052c1 100644
--- a/gcc/ada/exp_imgv.adb
+++ b/gcc/ada/exp_imgv.adb
@@ -896,9 +896,7 @@ package body Exp_Imgv is
-- Apply a validity check, since it is a bit drastic to get a
-- completely junk image value for an invalid value.
- if not Expr_Known_Valid (Expr) then
- Insert_Valid_Check (Expr);
- end if;
+ Insert_Valid_Check (Expr);
-- Generate:
-- P1 : constant Natural := Typ'Pos (Typ?(Expr));
@@ -1249,9 +1247,7 @@ package body Exp_Imgv is
-- Apply a validity check, since it is a bit drastic to get a
-- completely junk image value for an invalid value.
- if not Expr_Known_Valid (Expr) then
- Insert_Valid_Check (Expr);
- end if;
+ Insert_Valid_Check (Expr);
Enum_Case := True;
end if;