+2016-06-22 Justin Squirek <squirek@adacore.com>
+
+ * sem_ch8.adb (Push_Scope): Add a check for when the
+ scope table is empty to assign the global variable
+ Configuration_Component_Alignment.
+ * sem.adb (Do_Analyze): Add Configuration_Component_Alignment
+ to be assigned when the environment is cleaned instead of the
+ default.
+ * sem.ads Add a global variable Configuration_Component_Alignment
+ to store the value given by pragma Component_Alignment in the
+ context of a configuration file.
+ * sem_prag.adb (Analyze_Pragma): Correct the case for
+ Component_Alignment so that the pragma is verified and add
+ comments to explain how it is applied to the scope stack.
+
+2016-06-22 Justin Squirek <squirek@adacore.com>
+
+ * sprint.adb (Sprint_Node_Actual): Add check in
+ the case of an N_Object_Declaration when evaluating an expression
+ to properly ignore errors.
+
2016-06-22 Bob Duff <duff@adacore.com>
* g-comlin.ads (Parameter_Type): Change subtype of Last to
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;
-- 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
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;
("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;
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;
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
end if;
end;
- if Present (Expression (Node)) then
+ if Present (Expression (Node))
+ and then Expression (Node) /= Error
+ then
Write_Str (" := ");
Sprint_Node (Expression (Node));
end if;