===================================================================
@@ -1355,7 +1355,8 @@
Outer_Generic_Scope := Empty;
Scope_Suppress := Suppress_Options;
Scope_Stack.Table
- (Scope_Stack.Last).Component_Alignment_Default := Calign_Default;
+ (Scope_Stack.Last).Component_Alignment_Default :=
+ Configuration_Component_Alignment;
Scope_Stack.Table
(Scope_Stack.Last).Is_Active_Stack_Base := True;
===================================================================
@@ -461,6 +461,11 @@
-- Transient blocks have three associated actions list, to be inserted
-- before and after the block's statements, and as cleanup actions.
+ Configuration_Component_Alignment : Component_Alignment_Kind :=
+ Calign_Default;
+ -- Used for handling the pragma Component_Alignment in the context of a
+ -- configuration file.
+
type Scope_Stack_Entry is record
Entity : Entity_Id;
-- Entity representing the scope
===================================================================
@@ -8192,10 +8192,22 @@
SST.Save_Default_SSO := Default_SSO;
SST.Save_Uneval_Old := Uneval_Old;
+ -- Each new scope pushed onto the scope stack inherits the component
+ -- alignment of the previous scope. This emulates the "visibility"
+ -- semantics of pragma Component_Alignment.
+
if Scope_Stack.Last > Scope_Stack.First then
SST.Component_Alignment_Default := Scope_Stack.Table
(Scope_Stack.Last - 1).
Component_Alignment_Default;
+
+ -- Otherwise, this is the first scope being pushed on the scope
+ -- stack. Inherit the component alignment from the configuration
+ -- form of pragma Component_Alignment (if any).
+
+ else
+ SST.Component_Alignment_Default :=
+ Configuration_Component_Alignment;
end if;
SST.Last_Subprogram_Name := null;
===================================================================
@@ -12787,9 +12787,21 @@
("invalid Form parameter for pragma%", Form);
end if;
+ -- The pragma appears in a configuration file
+
+ if No (Parent (N)) then
+ Check_Valid_Configuration_Pragma;
+
+ -- Capture the component alignment in a global variable when
+ -- the pragma appears in a configuration file. Note that the
+ -- scope stack is empty at this point and cannot be used to
+ -- store the alignment value.
+
+ Configuration_Component_Alignment := Atype;
+
-- Case with no name, supplied, affects scope table entry
- if No (Name) then
+ elsif No (Name) then
Scope_Stack.Table
(Scope_Stack.Last).Component_Alignment_Default := Atype;
@@ -20901,7 +20913,7 @@
Mode_Id := Get_SPARK_Mode_Type (Mode);
Context := Parent (N);
- -- The pragma appears in a configuration pragmas file
+ -- The pragma appears in a configuration file
if No (Context) then
Check_Valid_Configuration_Pragma;