[Ada] Implement new legality rules introduced in C.6(12) by AI12-0363
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 7 Sep 2020 16:25:23 +0000 (18:25 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 23 Oct 2020 08:25:02 +0000 (04:25 -0400)
commitb120ca616fc820e352a19523dae34f5c53bfe859
treea1c3cdf69ff403e07cabb282d2f6643041a3bdc9
parent84a5809c7214d103dd2e7f5c352fd99cb8320bb3
[Ada] Implement new legality rules introduced in C.6(12) by AI12-0363

gcc/ada/

* doc/gnat_rm/implementation_defined_pragmas.rst (VFA): Remove uage
restrictions in conjunction with Atomic and Aliased.
* gnat_rm.texi: Regenerate.
* aspects.ads (Aspect_Id): Add Aspect_Full_Access_Only.
(Is_Representation_Aspect): Likewise.
(Aspect_Names): Likewise.
(Aspect_Delay): Likewise.
* einfo.ads (Is_Atomic_Or_VFA): Rename into...
(Is_Full_Access): ...this.
(Is_Volatile_Full_Access): Document new usage for Full_Access_Only.
* einfo.adb (Is_Atomic_Or_VFA): Rename into...
(Is_Full_Access): ...this.
* freeze.ads (Is_Atomic_VFA_Aggregate): Rename into...
(Is_Full_Access_Aggregate): ...this.
* freeze.adb (Is_Atomic_VFA_Aggregate): Rename into...
(Is_Full_Access_Aggregate): ...this.  Adjust to above renaming.
(Freeze_Array_Type): Likewise.
(Freeze_Entity): Likewise.
* exp_aggr.adb (Aggr_Assignment_OK_For_Backend): Likewise.
(Expand_Record_Aggregate): Likewise.
* exp_ch4.adb (Expand_N_Op_Eq): Likewise.
* exp_ch5.adb (Expand_Assign_Array): Likewise.
* exp_ch8.adb (Evaluation_Required): Likewise.
* layout.adb (Layout_Type): Likewise.
(Set_Composite_Alignment): Likewise.
* sem_aux.ads (Has_Rep_Item): Delete.
* sem_aux.adb (Has_Rep_Item): Likewise.
* sem_attr.adb (Resolve_Attribute) <Attribute_Access>: Implement
new legality rules in C.6(12).
* sem_ch12.adb (Instantiate_Object): Likewise.
* sem_res.adb (Resolve_Actuals): Likewise.
* sem_ch13.adb (Inherit_Delayed_Rep_Aspects): Deal with aspect
Full_Access_Only.
(Check_False_Aspect_For_Derived_Type): Likewise.
(Make_Pragma_From_Boolean_Aspect): Test for the presence of Expr.
Deal with aspect Full_Access_Only.
(Analyze_Aspects_At_Freeze_Point): Likewise.
(Analyze_One_Aspect): Do not set Delay_Required to true even for
Always_Delay boolean aspects if they have no expression.  Force
Delay_Required to true for aspect Full_Access_Only in all cases.
Reject aspect Full_Access_Only if not in Ada 2020 mode.
(Check_Aspect_At_End_Of_Declarations): Deal with empty expression.
(Check_Aspect_At_Freeze_Point): Likewise.
(Rep_Item_Entity): Delete.
(Inherit_Aspects_At_Freeze_Point): Align handling for Bit_Order
with that for Scalar_Storage_Order.
* sem_prag.adb (Check_Atomic_VFA): Delete.
(Check_VFA_Conflicts): Likewise.
(Check_Full_Access_Only): New procedure.
(Process_Atomic_Independent_Shared_Volatile): Call to implement
the new legality checks in C.6(8/2) and mark the entity last.
(Analyze_Pragma) <Pragma_Atomic_Components>: Remove obsolete check.
* sem_util.ads (Is_Atomic_Or_VFA_Object): Rename into...
(Is_Full_Access_Object): ...this.
(Is_Subcomponent_Of_Atomic_Object): Rename into...
(Is_Subcomponent_Of_Full_Access_Object): ...this.
* sem_util.adb (Inherit_Rep_Item_Chain): Use Present_In_Rep_Item.
(Is_Atomic_Or_VFA_Object): Rename into...
(Is_Full_Access_Object): ...this.
(Is_Subcomponent_Of_Atomic_Object): Rename into...
(Is_Subcomponent_Of_Full_Access_Object): ...this and adjust.
* snames.ads-tmpl (Name_Full_Access_Only): New name of aspect.
* gcc-interface/decl.c (gnat_to_gnu_entity): Adjust for renaming.
(promote_object_alignment): Likewise.
(gnat_to_gnu_field): Likewise.  Rename local variable and use
specific qualifier in error message for Volatile_Full_Access.
* gcc-interface/trans.c (lvalue_required_p): Likewise.
24 files changed:
gcc/ada/aspects.ads
gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst
gcc/ada/einfo.adb
gcc/ada/einfo.ads
gcc/ada/exp_aggr.adb
gcc/ada/exp_ch4.adb
gcc/ada/exp_ch5.adb
gcc/ada/exp_ch8.adb
gcc/ada/freeze.adb
gcc/ada/freeze.ads
gcc/ada/gcc-interface/decl.c
gcc/ada/gcc-interface/trans.c
gcc/ada/gnat_rm.texi
gcc/ada/layout.adb
gcc/ada/sem_attr.adb
gcc/ada/sem_aux.adb
gcc/ada/sem_aux.ads
gcc/ada/sem_ch12.adb
gcc/ada/sem_ch13.adb
gcc/ada/sem_prag.adb
gcc/ada/sem_res.adb
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads
gcc/ada/snames.ads-tmpl