aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/nlists.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2017-01-20 11:38:41 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2017-01-20 11:38:41 +0100
commitf68fc405bb5b38c545498c4a1dba203e51dade32 (patch)
tree57d5fd22e8f8871d01ffd76cb2d29d32468b518e /gcc/ada/nlists.adb
parentf4ef7b06ce8973846a7002c9325c576e099917d6 (diff)
downloadgcc-f68fc405bb5b38c545498c4a1dba203e51dade32.zip
gcc-f68fc405bb5b38c545498c4a1dba203e51dade32.tar.gz
gcc-f68fc405bb5b38c545498c4a1dba203e51dade32.tar.bz2
[multiple changes]
2017-01-20 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Check_Nonoverridable_Aspects); Refine check for illegal inherited Implicit_Dereference aspects with renamed discriminants. 2017-01-20 Javier Miranda <miranda@adacore.com> * debug.adb (switch d.6): do not avoid declaring unreferenced itypes. * nlists.ads (Lock_Lists, Unlock_Lists): New subprograms. * nlists.adb (Lock_Lists, Unlock_Lists): New subprograms. (Set_First, Set_Last, Set_List_Link, Set_Next, Set_Parent, Set_Prev, Tree_Read): Adding assertion. * atree.ads (Lock_Nodes, Unlock_Nodes): New subprograms. * atree.adb (Lock_Nodes, Unlock_Nodes): New subprograms. (Set_Analyzed, Set_Check_Actuals, Set_Comes_From_Source, Set_Ekind, Set_Error_Posted, Set_Has_Aspects, Set_Is_Ignored_Ghost_Node, Set_Original_Node, Set_Paren_Count, Set_Parent, Set_Sloc, Set_Nkind, Set_FieldNN, Set_NodeNN, Set_ListNN, Set_ElistNN, Set_NameN, Set_StrN, Set_UintNN, Set_UrealNN, Set_FlagNNN, Set_NodeN_With_Parent, Set_ListN_With_Parent): Adding assertion. 2017-01-20 Ed Schonberg <schonberg@adacore.com> * sem_prag.adb (Process_Convention): Diagnose properly a pragma import that applies to several homograph subprograms. when one of them is declared by a subprogram body. 2017-01-20 Justin Squirek <squirek@adacore.com> * exp_ch6.adb (Expand_Call): Remove optimization that nulls out calls to null procedures. From-SVN: r244699
Diffstat (limited to 'gcc/ada/nlists.adb')
-rw-r--r--gcc/ada/nlists.adb31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/ada/nlists.adb b/gcc/ada/nlists.adb
index b5b2d8a..db6a5c8 100644
--- a/gcc/ada/nlists.adb
+++ b/gcc/ada/nlists.adb
@@ -40,6 +40,10 @@ with Sinfo; use Sinfo;
with Table;
package body Nlists is
+ Locked : Boolean := False;
+ -- Compiling with assertions enabled, list contents modifications are
+ -- permitted only when this switch is set to False; compiling without
+ -- assertions this lock has no effect.
use Atree_Private_Part;
-- Get access to Nodes table
@@ -727,6 +731,16 @@ package body Nlists is
Next_Node.Release;
end Lock;
+ ----------------
+ -- Lock_Lists --
+ ----------------
+
+ procedure Lock_Lists is
+ begin
+ pragma Assert (not Locked);
+ Locked := True;
+ end Lock_Lists;
+
-------------------
-- New_Copy_List --
-------------------
@@ -1403,6 +1417,7 @@ package body Nlists is
procedure Set_First (List : List_Id; To : Node_Or_Entity_Id) is
begin
+ pragma Assert (not Locked);
Lists.Table (List).First := To;
end Set_First;
@@ -1412,6 +1427,7 @@ package body Nlists is
procedure Set_Last (List : List_Id; To : Node_Or_Entity_Id) is
begin
+ pragma Assert (not Locked);
Lists.Table (List).Last := To;
end Set_Last;
@@ -1421,6 +1437,7 @@ package body Nlists is
procedure Set_List_Link (Node : Node_Or_Entity_Id; To : List_Id) is
begin
+ pragma Assert (not Locked);
Nodes.Table (Node).Link := Union_Id (To);
end Set_List_Link;
@@ -1430,6 +1447,7 @@ package body Nlists is
procedure Set_Next (Node : Node_Or_Entity_Id; To : Node_Or_Entity_Id) is
begin
+ pragma Assert (not Locked);
Next_Node.Table (Node) := To;
end Set_Next;
@@ -1439,6 +1457,7 @@ package body Nlists is
procedure Set_Parent (List : List_Id; Node : Node_Or_Entity_Id) is
begin
+ pragma Assert (not Locked);
pragma Assert (List <= Lists.Last);
Lists.Table (List).Parent := Node;
end Set_Parent;
@@ -1449,6 +1468,7 @@ package body Nlists is
procedure Set_Prev (Node : Node_Or_Entity_Id; To : Node_Or_Entity_Id) is
begin
+ pragma Assert (not Locked);
Prev_Node.Table (Node) := To;
end Set_Prev;
@@ -1458,6 +1478,7 @@ package body Nlists is
procedure Tree_Read is
begin
+ pragma Assert (not Locked);
Lists.Tree_Read;
Next_Node.Tree_Read;
Prev_Node.Tree_Read;
@@ -1485,4 +1506,14 @@ package body Nlists is
Next_Node.Locked := False;
end Unlock;
+ ------------------
+ -- Unlock_Lists --
+ ------------------
+
+ procedure Unlock_Lists is
+ begin
+ pragma Assert (Locked);
+ Locked := False;
+ end Unlock_Lists;
+
end Nlists;