aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Squirek <squirek@adacore.com>2016-06-22 10:42:46 +0000
committerArnaud Charlet <charlet@adacore.com>2016-06-22 10:42:46 +0000
commit04a49e58e802a293d9c94cc23fa411d3c2c71d4d (patch)
treec35548449fd5d924b590fb1c7b93d165c5f631a0
parent078886ab9584788798ed1f832d104f37b3574076 (diff)
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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237694 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/ChangeLog21
-rw-r--r--gcc/ada/sem.adb3
-rw-r--r--gcc/ada/sem.ads5
-rw-r--r--gcc/ada/sem_ch8.adb12
-rw-r--r--gcc/ada/sem_prag.adb16
-rw-r--r--gcc/ada/sprint.adb6
6 files changed, 58 insertions, 5 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index b4e4cf5356f..82d33d026bb 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -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
diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb
index 3cd073082a9..ea5f4741727 100644
--- a/gcc/ada/sem.adb
+++ b/gcc/ada/sem.adb
@@ -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;
diff --git a/gcc/ada/sem.ads b/gcc/ada/sem.ads
index c52f6b492e7..f9c2dadabf3 100644
--- a/gcc/ada/sem.ads
+++ b/gcc/ada/sem.ads
@@ -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
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index e1b31aaa34a..0c5860b81d9 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -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;
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index ccaa8e90f6e..d17dee2aefa 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -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;
diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb
index b1def4b722a..0185719b795 100644
--- a/gcc/ada/sprint.adb
+++ b/gcc/ada/sprint.adb
@@ -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;