This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Scalar_Storage_Order must be consistent between any component of a composite type (array or record) and the composite type itself. We already enforced this in the case where the enclosing type has a Scalar_Storage_Order attribute definition, and the component type has none. We now also do so also in the opposite case when the enclosing type has no Scalar_Storage_Order clause, and any component does have one. The following compilation must be rejected with the indicated error messages: $ gcc -c nat_comp_rev_el.ads nat_comp_rev_el.ads:26:04: composite type must have explicit scalar storage order nat_comp_rev_el.ads:27:04: composite type must have explicit scalar storage order nat_comp_rev_el.ads:29:07: composite type must have explicit scalar storage order nat_comp_rev_el.ads:34:07: composite type must have explicit scalar storage order with System; use System; package Nat_Comp_Rev_El is type U32 is mod 2**32; type LE_Record is record X : U32; end record; for LE_Record use record X at 0 range 0 .. 31; end record; for LE_Record'Bit_Order use Low_Order_First; for LE_Record'Scalar_Storage_Order use Low_Order_First; type BE_Record is record X : U32; end record; for BE_Record use record X at 0 range 0 .. 31; end record; for BE_Record'Bit_Order use High_Order_First; for BE_Record'Scalar_Storage_Order use High_Order_First; -- Reject the below declarations: the component type has an explicit SSO, -- so we also require one on the enclosing composite type. type Two_LE is array (1 .. 2) of LE_Record; type Two_BE is array (1 .. 2) of BE_Record; type Rec_LE is record Comp : LE_Record; X : Integer; end record; type Rec_BE is record Comp : BE_Record; X : Integer; end record; end Nat_Comp_Rev_El; Tested on x86_64-pc-linux-gnu, committed on trunk 2013-10-17 Thomas Quinot <quinot@adacore.com> * freeze.adb (Check_Component_Storage_Order): Reject a record or array type that does not have an explicit Scalar_Storage_Order attribute definition if a component of the record, or the elements of the array, have one. * gnat_rm.texi (attribute Scalar_Storage_Order): Document the above rule.
Attachment:
difs
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |