Commit e4b1cd76 by Yannick Moy Committed by Arnaud Charlet

sem_util.adb: Minor refactoring.

2017-04-25  Yannick Moy  <moy@adacore.com>

	* sem_util.adb: Minor refactoring.
	* freeze.adb (Freeze_Record_Type): Fix checking of SPARK RM 7.1.3(5).

From-SVN: r247211
parent 245fee17
2017-04-25 Yannick Moy <moy@adacore.com>
* sem_util.adb: Minor refactoring.
* freeze.adb (Freeze_Record_Type): Fix checking of SPARK RM 7.1.3(5).
2017-04-25 Claire Dross <dross@adacore.com>
* sem_prag.adb (Collect_Inherited_Class_Wide_Conditions): Go to
......
......@@ -4625,9 +4625,11 @@ package body Freeze is
if Is_Effectively_Volatile (Rec) then
-- A discriminated type cannot be effectively volatile
-- (SPARK RM C.6(4)).
-- (SPARK RM 7.1.3(5)).
if Has_Discriminants (Rec) then
if Has_Discriminants (Rec)
and then not Is_Protected_Type (Rec)
then
Error_Msg_N ("discriminated type & cannot be volatile", Rec);
-- A tagged type cannot be effectively volatile
......@@ -4638,7 +4640,7 @@ package body Freeze is
end if;
-- A non-effectively volatile record type cannot contain
-- effectively volatile components (SPARK RM C.6(2)).
-- effectively volatile components (SPARK RM 7.1.3(6)).
else
Comp := First_Component (Rec);
......
......@@ -12808,14 +12808,18 @@ package body Sem_Util is
declare
Anc : Entity_Id := Base_Type (Id);
begin
if Ekind (Anc) in Private_Kind then
if Is_Private_Type (Anc) then
Anc := Full_View (Anc);
end if;
-- Test for presence of ancestor, as the full view of a private
-- type may be missing in case of error.
return
Has_Volatile_Components (Id)
or else
Is_Effectively_Volatile (Component_Type (Anc));
(Present (Anc)
and then Is_Effectively_Volatile (Component_Type (Anc)));
end;
-- A protected type is always volatile
......
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