[Ada] Ignore out of range values for System.Priority in CodePeer mode
2018-05-30 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * checks.adb (Apply_Scalar_Range_Check): * sem_eval.adb (Check_Non_Static_Context, Out_Of_Range): Ignore out of range values for System.Priority in CodePeer mode since the actual target compiler may provide a wider range. From-SVN: r260929
This commit is contained in:
parent
8ed508fe7f
commit
88ad52c90d
@ -1,3 +1,10 @@
|
|||||||
|
2018-05-30 Arnaud Charlet <charlet@adacore.com>
|
||||||
|
|
||||||
|
* checks.adb (Apply_Scalar_Range_Check):
|
||||||
|
* sem_eval.adb (Check_Non_Static_Context, Out_Of_Range): Ignore out of
|
||||||
|
range values for System.Priority in CodePeer mode since the actual
|
||||||
|
target compiler may provide a wider range.
|
||||||
|
|
||||||
2018-05-30 Ed Schonberg <schonberg@adacore.com>
|
2018-05-30 Ed Schonberg <schonberg@adacore.com>
|
||||||
|
|
||||||
* exp_unst.adb: Search specification of main unit as well, for
|
* exp_unst.adb: Search specification of main unit as well, for
|
||||||
|
@ -3065,7 +3065,16 @@ package body Checks is
|
|||||||
-- If definitely not in range, warn
|
-- If definitely not in range, warn
|
||||||
|
|
||||||
elsif Lov > Hi or else Hiv < Lo then
|
elsif Lov > Hi or else Hiv < Lo then
|
||||||
Bad_Value;
|
-- Ignore out of range values for System.Priority in
|
||||||
|
-- CodePeer mode since the actual target compiler may
|
||||||
|
-- provide a wider range.
|
||||||
|
|
||||||
|
if not CodePeer_Mode
|
||||||
|
or else Target_Typ /= RTE (RE_Priority)
|
||||||
|
then
|
||||||
|
Bad_Value;
|
||||||
|
end if;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
-- Otherwise we don't know
|
-- Otherwise we don't know
|
||||||
|
@ -574,8 +574,16 @@ package body Sem_Eval is
|
|||||||
null;
|
null;
|
||||||
|
|
||||||
elsif Is_Out_Of_Range (N, T, Assume_Valid => True) then
|
elsif Is_Out_Of_Range (N, T, Assume_Valid => True) then
|
||||||
Apply_Compile_Time_Constraint_Error
|
-- Ignore out of range values for System.Priority in CodePeer
|
||||||
(N, "value not in range of}<<", CE_Range_Check_Failed);
|
-- mode since the actual target compiler may provide a wider
|
||||||
|
-- range.
|
||||||
|
|
||||||
|
if CodePeer_Mode and then T = RTE (RE_Priority) then
|
||||||
|
Set_Do_Range_Check (N, False);
|
||||||
|
else
|
||||||
|
Apply_Compile_Time_Constraint_Error
|
||||||
|
(N, "value not in range of}<<", CE_Range_Check_Failed);
|
||||||
|
end if;
|
||||||
|
|
||||||
elsif Checks_On then
|
elsif Checks_On then
|
||||||
Enable_Range_Check (N);
|
Enable_Range_Check (N);
|
||||||
@ -5437,9 +5445,11 @@ package body Sem_Eval is
|
|||||||
First_Rep_Item (Parent (N)));
|
First_Rep_Item (Parent (N)));
|
||||||
Rewrite (N, Make_Integer_Literal (Sloc (N), Uint_1));
|
Rewrite (N, Make_Integer_Literal (Sloc (N), Uint_1));
|
||||||
|
|
||||||
-- All cases except the special array case
|
-- All cases except the special array case.
|
||||||
|
-- No message if we are dealing with System.Priority values in
|
||||||
|
-- CodePeer mode where the target runtime may have more priorities.
|
||||||
|
|
||||||
else
|
elsif not CodePeer_Mode or else Etype (N) /= RTE (RE_Priority) then
|
||||||
Apply_Compile_Time_Constraint_Error
|
Apply_Compile_Time_Constraint_Error
|
||||||
(N, "value not in range of}", CE_Range_Check_Failed);
|
(N, "value not in range of}", CE_Range_Check_Failed);
|
||||||
end if;
|
end if;
|
||||||
|
Loading…
Reference in New Issue
Block a user