sem_ch8.adb (Push_Scope): Add a check for when the scope table is empty to assign the global variable...

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.

From-SVN: r237694
This commit is contained in:
Justin Squirek 2016-06-22 10:42:46 +00:00 committed by Arnaud Charlet
parent d1aea5ddc5
commit 194d6f3fc9
6 changed files with 58 additions and 5 deletions

View File

@ -1,3 +1,24 @@
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

View File

@ -1355,7 +1355,8 @@ package body Sem is
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;

View File

@ -461,6 +461,11 @@ package Sem is
-- 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

View File

@ -8192,10 +8192,22 @@ package body Sem_Ch8 is
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;

View File

@ -12787,9 +12787,21 @@ package body Sem_Prag is
("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 @@ package body Sem_Prag is
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;

View File

@ -6,7 +6,7 @@
-- --
-- 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- --
@ -2385,7 +2385,9 @@ package body Sprint is
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;