+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
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
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);
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