Commit 94eefd2e by Robert Dewar Committed by Arnaud Charlet

exp_ch4.adb (Expand_N_In): Suppress range warnings in instances

2008-08-04  Robert Dewar  <dewar@adacore.com>

	* exp_ch4.adb (Expand_N_In): Suppress range warnings in instances

From-SVN: r138649
parent 9b26c96e
...@@ -3873,6 +3873,12 @@ package body Exp_Ch4 is ...@@ -3873,6 +3873,12 @@ package body Exp_Ch4 is
and then Compile_Time_Known_Value (Hi) and then Compile_Time_Known_Value (Hi)
and then Expr_Value (Type_High_Bound (Ltyp)) = Expr_Value (Hi) and then Expr_Value (Type_High_Bound (Ltyp)) = Expr_Value (Hi)
and then Expr_Value (Type_Low_Bound (Ltyp)) = Expr_Value (Lo) and then Expr_Value (Type_Low_Bound (Ltyp)) = Expr_Value (Lo)
-- Kill warnings in instances, since they may be cases where we
-- have a test in the generic that makes sense with some types
-- and not with other types.
and then not In_Instance
then then
Substitute_Valid_Check; Substitute_Valid_Check;
return; return;
...@@ -3886,7 +3892,7 @@ package body Exp_Ch4 is ...@@ -3886,7 +3892,7 @@ package body Exp_Ch4 is
-- legality checks, because we are constant-folding beyond RM 4.9. -- legality checks, because we are constant-folding beyond RM 4.9.
if Lcheck = LT or else Ucheck = GT then if Lcheck = LT or else Ucheck = GT then
if Warn1 then if Warn1 and then not In_Instance then
Error_Msg_N ("?range test optimized away", N); Error_Msg_N ("?range test optimized away", N);
Error_Msg_N ("\?value is known to be out of range", N); Error_Msg_N ("\?value is known to be out of range", N);
end if; end if;
...@@ -3902,7 +3908,7 @@ package body Exp_Ch4 is ...@@ -3902,7 +3908,7 @@ package body Exp_Ch4 is
-- since we know we are in range. -- since we know we are in range.
elsif Lcheck in Compare_GE and then Ucheck in Compare_LE then elsif Lcheck in Compare_GE and then Ucheck in Compare_LE then
if Warn1 then if Warn1 and then not In_Instance then
Error_Msg_N ("?range test optimized away", N); Error_Msg_N ("?range test optimized away", N);
Error_Msg_N ("\?value is known to be in range", N); Error_Msg_N ("\?value is known to be in range", N);
end if; end if;
...@@ -3919,7 +3925,7 @@ package body Exp_Ch4 is ...@@ -3919,7 +3925,7 @@ package body Exp_Ch4 is
-- a comparison against the upper bound. -- a comparison against the upper bound.
elsif Lcheck in Compare_GE then elsif Lcheck in Compare_GE then
if Warn2 then if Warn2 and then not In_Instance then
Error_Msg_N ("?lower bound test optimized away", Lo); Error_Msg_N ("?lower bound test optimized away", Lo);
Error_Msg_N ("\?value is known to be in range", Lo); Error_Msg_N ("\?value is known to be in range", Lo);
end if; end if;
...@@ -3937,7 +3943,7 @@ package body Exp_Ch4 is ...@@ -3937,7 +3943,7 @@ package body Exp_Ch4 is
-- a comparison against the lower bound. -- a comparison against the lower bound.
elsif Ucheck in Compare_LE then elsif Ucheck in Compare_LE then
if Warn2 then if Warn2 and then not In_Instance then
Error_Msg_N ("?upper bound test optimized away", Hi); Error_Msg_N ("?upper bound test optimized away", Hi);
Error_Msg_N ("\?value is known to be in range", Hi); Error_Msg_N ("\?value is known to be in range", Hi);
end if; end if;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment