aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/checks.ads
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-04-15 21:11:17 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-06-17 04:14:16 -0400
commit25f11dfe76f537afd72380a698eba3a98a9f694a (patch)
treecf9cfcb7aa666bb999b9c1088413a33efe81af66 /gcc/ada/checks.ads
parentcf9087af1f963e52ed4f0d3b8594e2214bd7b312 (diff)
downloadgcc-25f11dfe76f537afd72380a698eba3a98a9f694a.zip
gcc-25f11dfe76f537afd72380a698eba3a98a9f694a.tar.gz
gcc-25f11dfe76f537afd72380a698eba3a98a9f694a.tar.bz2
[Ada] Do not generate useless length check for array initialization
2020-06-17 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * checks.ads (Apply_Length_Check_On_Assignment): Declare. * checks.adb (Apply_Length_Check_On_Assignment): New procedure to apply a length check to an expression in an assignment. * exp_ch5.adb (Expand_Assign_Array): Call it instead of calling Apply_Length_Check to generate a length check. * sem_ch5.adb (Analyze_Assignment): Likewise.
Diffstat (limited to 'gcc/ada/checks.ads')
-rw-r--r--gcc/ada/checks.ads9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/ada/checks.ads b/gcc/ada/checks.ads
index 6412686..79657c3 100644
--- a/gcc/ada/checks.ads
+++ b/gcc/ada/checks.ads
@@ -569,6 +569,15 @@ package Checks is
-- processes it as described above for consistency with the other routines
-- in this section.
+ procedure Apply_Length_Check_On_Assignment
+ (Expr : Node_Id;
+ Target_Typ : Entity_Id;
+ Target : Node_Id;
+ Source_Typ : Entity_Id := Empty);
+ -- Similar to Apply_Length_Check, but takes the target of an assignment for
+ -- which the check is to be done. Used to filter out specific cases where
+ -- the check is superfluous.
+
procedure Apply_Range_Check
(Expr : Node_Id;
Target_Typ : Entity_Id;