aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2021-12-09 12:57:35 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2022-01-06 17:11:40 +0000
commit362c58c423daaea092194fda6f4905bd3af23c1c (patch)
tree07784cfd172042547927cde9311ac3f9275934a5 /gcc
parenta17774924232ef28d8f6ddd627a01c458c91c76b (diff)
downloadgcc-362c58c423daaea092194fda6f4905bd3af23c1c.zip
gcc-362c58c423daaea092194fda6f4905bd3af23c1c.tar.gz
gcc-362c58c423daaea092194fda6f4905bd3af23c1c.tar.bz2
[Ada] Remove a locally handled exception
gcc/ada/ * exp_ch4.adb (Expand_Concatenate): There is no reason for using declaring, raising and catching an exception; a simple return statement is enough.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/exp_ch4.adb27
1 files changed, 10 insertions, 17 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index e36410d..21fa515 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -2695,9 +2695,6 @@ package body Exp_Ch4 is
-- lengths of operands. The choice of this type is a little subtle and
-- is discussed in a separate section at the start of the body code.
- Concatenation_Error : exception;
- -- Raised if concatenation is sure to raise a CE
-
Result_May_Be_Null : Boolean := True;
-- Reset to False if at least one operand is encountered which is known
-- at compile time to be non-null. Used for handling the special case
@@ -3460,7 +3457,16 @@ package body Exp_Ch4 is
-- Catch the static out of range case now
if Raises_Constraint_Error (High_Bound) then
- raise Concatenation_Error;
+ -- Kill warning generated for the declaration of the static out of
+ -- range high bound, and instead generate a Constraint_Error with
+ -- an appropriate specific message.
+
+ Kill_Dead_Code (Declaration_Node (Entity (High_Bound)));
+ Apply_Compile_Time_Constraint_Error
+ (N => Cnode,
+ Msg => "concatenation result upper bound out of range??",
+ Reason => CE_Range_Check_Failed);
+ return;
end if;
-- Now we will generate the assignments to do the actual concatenation
@@ -3629,19 +3635,6 @@ package body Exp_Ch4 is
pragma Assert (Present (Result));
Rewrite (Cnode, Result);
Analyze_And_Resolve (Cnode, Atyp);
-
- exception
- when Concatenation_Error =>
-
- -- Kill warning generated for the declaration of the static out of
- -- range high bound, and instead generate a Constraint_Error with
- -- an appropriate specific message.
-
- Kill_Dead_Code (Declaration_Node (Entity (High_Bound)));
- Apply_Compile_Time_Constraint_Error
- (N => Cnode,
- Msg => "concatenation result upper bound out of range??",
- Reason => CE_Range_Check_Failed);
end Expand_Concatenate;
---------------------------------------------------