diff options
author | Justin Squirek <squirek@adacore.com> | 2016-06-22 10:42:46 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2016-06-22 12:42:46 +0200 |
commit | 194d6f3fc91c5642cb2dd9e93379af66d5e71e0c (patch) | |
tree | c35548449fd5d924b590fb1c7b93d165c5f631a0 | |
parent | d1aea5ddc5c0667762f8e0138c60199ba0f31fe2 (diff) | |
download | gcc-194d6f3fc91c5642cb2dd9e93379af66d5e71e0c.zip gcc-194d6f3fc91c5642cb2dd9e93379af66d5e71e0c.tar.gz gcc-194d6f3fc91c5642cb2dd9e93379af66d5e71e0c.tar.bz2 |
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
-rw-r--r-- | gcc/ada/ChangeLog | 21 | ||||
-rw-r--r-- | gcc/ada/sem.adb | 3 | ||||
-rw-r--r-- | gcc/ada/sem.ads | 5 | ||||
-rw-r--r-- | gcc/ada/sem_ch8.adb | 12 | ||||
-rw-r--r-- | gcc/ada/sem_prag.adb | 16 | ||||
-rw-r--r-- | gcc/ada/sprint.adb | 6 |
6 files changed, 58 insertions, 5 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b4e4cf5..82d33d0 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 3cd0730..ea5f474 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 c52f6b4..f9c2dad 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 e1b31aa..0c5860b 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 ccaa8e9..d17dee2a 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 b1def4b..0185719 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; |