Commit dc9111cf by Eric Botcazou Committed by Arnaud Charlet

freeze.adb (Check_Component_Storage_Order): Skip a record component if it has…

freeze.adb (Check_Component_Storage_Order): Skip a record component if it has Complex_Representation.

2015-10-26  Eric Botcazou  <ebotcazou@adacore.com>

	* freeze.adb (Check_Component_Storage_Order): Skip a record
	component if it has Complex_Representation.
	(Freeze_Record_Type): If the type has Complex_Representation, skip the
	regular treatment of Scalar_Storage_Order attribute and instead issue
	a warning if it is present.

From-SVN: r229325
parent 930e85a3
2015-10-26 Eric Botcazou <ebotcazou@adacore.com>
* freeze.adb (Check_Component_Storage_Order): Skip a record
component if it has Complex_Representation.
(Freeze_Record_Type): If the type has Complex_Representation, skip the
regular treatment of Scalar_Storage_Order attribute and instead issue
a warning if it is present.
2015-10-26 Bob Duff <duff@adacore.com>
* sem_ch13.adb (Check_Iterator_Functions): For a Default_Iterator
......
......@@ -1197,9 +1197,14 @@ package body Freeze is
Attribute_Scalar_Storage_Order);
Comp_ADC_Present := Present (Comp_ADC);
-- Case of record or array component: check storage order compatibility
-- Case of record or array component: check storage order compatibility.
-- But, if the record has Complex_Representation, then it is treated as
-- a scalar in the back end so the storage order is irrelevant.
if Is_Record_Type (Comp_Type) or else Is_Array_Type (Comp_Type) then
if (Is_Record_Type (Comp_Type)
and then not Has_Complex_Representation (Comp_Type))
or else Is_Array_Type (Comp_Type)
then
Comp_SSO_Differs :=
Reverse_Storage_Order (Encl_Type)
/=
......@@ -3940,15 +3945,27 @@ package body Freeze is
Next_Entity (Comp);
end loop;
SSO_ADC :=
Get_Attribute_Definition_Clause
(Rec, Attribute_Scalar_Storage_Order);
-- If the record type has Complex_Representation, then it is treated
-- as a scalar in the back end so the storage order is irrelevant.
if Has_Complex_Representation (Rec) then
if Present (SSO_ADC) then
Error_Msg_N
("??storage order has no effect with Complex_Representation",
SSO_ADC);
end if;
else
-- Deal with default setting of reverse storage order
Set_SSO_From_Default (Rec);
-- Check consistent attribute setting on component types
SSO_ADC := Get_Attribute_Definition_Clause
(Rec, Attribute_Scalar_Storage_Order);
declare
Comp_ADC_Present : Boolean;
begin
......@@ -3968,13 +3985,13 @@ package body Freeze is
if Present (SSO_ADC) then
-- Check compatibility of Scalar_Storage_Order with Bit_Order, if
-- the former is specified.
-- Check compatibility of Scalar_Storage_Order with Bit_Order,
-- if the former is specified.
if Reverse_Bit_Order (Rec) /= Reverse_Storage_Order (Rec) then
-- Note: report error on Rec, not on SSO_ADC, as ADC may apply
-- to some ancestor type.
-- Note: report error on Rec, not on SSO_ADC, as ADC may
-- apply to some ancestor type.
Error_Msg_Sloc := Sloc (SSO_ADC);
Error_Msg_N
......@@ -3982,7 +3999,7 @@ package body Freeze is
& "bit order", Rec);
end if;
-- Warn if there is an Scalar_Storage_Order attribute definition
-- Warn if there is a Scalar_Storage_Order attribute definition
-- clause but no component clause, no component that itself has
-- such an attribute definition, and no pragma Pack.
......@@ -3993,8 +4010,9 @@ package body Freeze is
Is_Packed (Rec))
then
Error_Msg_N
("??scalar storage order specified but no component clause",
SSO_ADC);
("??scalar storage order specified but no component "
& "clause", SSO_ADC);
end if;
end if;
end if;
......
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