summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ada/ChangeLog17
-rw-r--r--gcc/ada/a-cdlili.adb32
-rw-r--r--gcc/ada/a-cdlili.ads4
-rw-r--r--gcc/ada/a-cidlli.adb32
-rw-r--r--gcc/ada/a-cidlli.ads4
-rw-r--r--gcc/ada/a-cihama.adb65
-rw-r--r--gcc/ada/a-cihama.ads4
-rw-r--r--gcc/ada/a-cihase.adb38
-rw-r--r--gcc/ada/a-cihase.ads4
-rw-r--r--gcc/ada/a-ciorma.adb44
-rw-r--r--gcc/ada/a-ciorma.ads4
-rw-r--r--gcc/ada/a-ciormu.adb29
-rw-r--r--gcc/ada/a-ciormu.ads6
-rw-r--r--gcc/ada/a-ciorse.adb27
-rw-r--r--gcc/ada/a-ciorse.ads4
-rw-r--r--gcc/ada/a-cohama.adb67
-rw-r--r--gcc/ada/a-cohama.ads4
-rw-r--r--gcc/ada/a-cohase.adb40
-rw-r--r--gcc/ada/a-cohase.ads6
-rw-r--r--gcc/ada/a-coinve.adb42
-rw-r--r--gcc/ada/a-coinve.ads4
-rw-r--r--gcc/ada/a-convec.adb42
-rw-r--r--gcc/ada/a-convec.ads5
-rw-r--r--gcc/ada/a-coorma.adb44
-rw-r--r--gcc/ada/a-coorma.ads4
-rw-r--r--gcc/ada/a-coormu.adb29
-rw-r--r--gcc/ada/a-coormu.ads6
-rw-r--r--gcc/ada/a-coorse.adb27
-rw-r--r--gcc/ada/a-coorse.ads4
-rw-r--r--gcc/ada/bindgen.adb40
-rw-r--r--gcc/ada/sem_ch12.adb10
31 files changed, 672 insertions, 16 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 350f8e9c47f..b422f32e1d3 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,20 @@
+2011-11-04 Matthew Heaney <heaney@adacore.com>
+
+ * a-cdlili.ad[sb], a-cidlli.ad[sb], a-coorse.ad[sb], a-ciorse.ad[sb],
+ a-coorma.ad[sb], a-ciorma.ad[sb], a-coormu.ad[sb], a-ciormu.ad[sb],
+ a-cohama.ad[sb], a-cihama.ad[sb], a-cohase.ad[sb], a-cihase.ad[sb],
+ a-convec.ad[sb], a-coinve.ad[sb] (Assign, Copy): New operations
+ added to package.
+
+2011-11-04 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch12.adb: Minor reformatting
+
+2011-11-04 Gary Dismukes <dismukes@adacore.com>
+
+ * bindgen.adb (Gen_Elab_Calls): In the case of the AAMP target,
+ initialize elaboration entities to zero when specs are processed.
+
2011-10-28 Iain Sandoe <iains@gcc.gnu.org>
Eric Botcazou <ebotcazou@adacore.com>
diff --git a/gcc/ada/a-cdlili.adb b/gcc/ada/a-cdlili.adb
index 497a1112d43..326c74b0785 100644
--- a/gcc/ada/a-cdlili.adb
+++ b/gcc/ada/a-cdlili.adb
@@ -146,6 +146,27 @@ package body Ada.Containers.Doubly_Linked_Lists is
Insert (Container, No_Element, New_Item, Count);
end Append;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out List; Source : List) is
+ Node : Node_Access;
+
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+
+ Node := Source.First;
+ while Node /= null loop
+ Target.Append (Node.Element);
+ Node := Node.Next;
+ end loop;
+ end Assign;
+
-----------
-- Clear --
-----------
@@ -206,6 +227,17 @@ package body Ada.Containers.Doubly_Linked_Lists is
return Find (Container, Item) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy (Source : List) return List is
+ begin
+ return Target : List do
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
------------
-- Delete --
------------
diff --git a/gcc/ada/a-cdlili.ads b/gcc/ada/a-cdlili.ads
index d38b0d08ba3..2de03e520aa 100644
--- a/gcc/ada/a-cdlili.ads
+++ b/gcc/ada/a-cdlili.ads
@@ -90,6 +90,10 @@ package Ada.Containers.Doubly_Linked_Lists is
Position : Cursor;
Process : not null access procedure (Element : in out Element_Type));
+ procedure Assign (Target : in out List; Source : List);
+
+ function Copy (Source : List) return List;
+
procedure Move
(Target : in out List;
Source : in out List);
diff --git a/gcc/ada/a-cidlli.adb b/gcc/ada/a-cidlli.adb
index 849cb53c64a..42bd3c48313 100644
--- a/gcc/ada/a-cidlli.adb
+++ b/gcc/ada/a-cidlli.adb
@@ -171,6 +171,27 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
Insert (Container, No_Element, New_Item, Count);
end Append;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out List; Source : List) is
+ Node : Node_Access;
+
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+
+ Node := Source.First;
+ while Node /= null loop
+ Target.Append (Node.Element.all);
+ Node := Node.Next;
+ end loop;
+ end Assign;
+
-----------
-- Clear --
-----------
@@ -230,6 +251,17 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
return Find (Container, Item) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy (Source : List) return List is
+ begin
+ return Target : List do
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
------------
-- Delete --
------------
diff --git a/gcc/ada/a-cidlli.ads b/gcc/ada/a-cidlli.ads
index 8a23fc75442..c40ad30b155 100644
--- a/gcc/ada/a-cidlli.ads
+++ b/gcc/ada/a-cidlli.ads
@@ -90,6 +90,10 @@ package Ada.Containers.Indefinite_Doubly_Linked_Lists is
Position : Cursor;
Process : not null access procedure (Element : in out Element_Type));
+ procedure Assign (Target : in out List; Source : List);
+
+ function Copy (Source : List) return List;
+
procedure Move
(Target : in out List;
Source : in out List);
diff --git a/gcc/ada/a-cihama.adb b/gcc/ada/a-cihama.adb
index d4f2c1d92dc..b90c5426481 100644
--- a/gcc/ada/a-cihama.adb
+++ b/gcc/ada/a-cihama.adb
@@ -35,6 +35,8 @@ pragma Elaborate_All (Ada.Containers.Hash_Tables.Generic_Keys);
with Ada.Unchecked_Deallocation;
+with System; use type System.Address;
+
package body Ada.Containers.Indefinite_Hashed_Maps is
procedure Free_Key is
@@ -132,6 +134,41 @@ package body Ada.Containers.Indefinite_Hashed_Maps is
HT_Ops.Adjust (Container.HT);
end Adjust;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Map; Source : Map) is
+ procedure Insert_Item (Node : Node_Access);
+ pragma Inline (Insert_Item);
+
+ procedure Insert_Items is new HT_Ops.Generic_Iteration (Insert_Item);
+
+ -----------------
+ -- Insert_Item --
+ -----------------
+
+ procedure Insert_Item (Node : Node_Access) is
+ begin
+ Target.Insert (Key => Node.Key.all, New_Item => Node.Element.all);
+ end Insert_Item;
+
+ -- Start of processing for Assign
+
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+
+ if Target.Capacity < Source.Length then
+ Target.Reserve_Capacity (Source.Length);
+ end if;
+
+ Insert_Items (Target.HT);
+ end Assign;
+
--------------
-- Capacity --
--------------
@@ -159,6 +196,34 @@ package body Ada.Containers.Indefinite_Hashed_Maps is
return Find (Container, Key) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy
+ (Source : Map;
+ Capacity : Count_Type := 0) return Map
+ is
+ C : Count_Type;
+
+ begin
+ if Capacity = 0 then
+ C := Source.Length;
+
+ elsif Capacity >= Source.Length then
+ C := Capacity;
+
+ else
+ raise Capacity_Error
+ with "Requested capacity is less than Source length";
+ end if;
+
+ return Target : Map do
+ Target.Reserve_Capacity (C);
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
---------------
-- Copy_Node --
---------------
diff --git a/gcc/ada/a-cihama.ads b/gcc/ada/a-cihama.ads
index 1b16d8f4589..7c67c315583 100644
--- a/gcc/ada/a-cihama.ads
+++ b/gcc/ada/a-cihama.ads
@@ -134,6 +134,10 @@ package Ada.Containers.Indefinite_Hashed_Maps is
-- Calls Process with the key (with only a constant view) and element (with
-- a variable view) of the node designed by the cursor.
+ procedure Assign (Target : in out Map; Source : Map);
+
+ function Copy (Source : Map; Capacity : Count_Type := 0) return Map;
+
procedure Move (Target : in out Map; Source : in out Map);
-- Clears Target (if it's not empty), and then moves (not copies) the
-- buckets array and nodes from Source to Target.
diff --git a/gcc/ada/a-cihase.adb b/gcc/ada/a-cihase.adb
index e52f38bba9f..e29a204570e 100644
--- a/gcc/ada/a-cihase.adb
+++ b/gcc/ada/a-cihase.adb
@@ -173,6 +173,16 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
Free_Element (X);
end Assign;
+ procedure Assign (Target : in out Set; Source : Set) is
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Target.Union (Source);
+ end Assign;
+
--------------
-- Capacity --
--------------
@@ -200,6 +210,34 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
return Find (Container, Item) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy
+ (Source : Set;
+ Capacity : Count_Type := 0) return Set
+ is
+ C : Count_Type;
+
+ begin
+ if Capacity = 0 then
+ C := Source.Length;
+
+ elsif Capacity >= Source.Length then
+ C := Capacity;
+
+ else
+ raise Capacity_Error
+ with "Requested capacity is less than Source length";
+ end if;
+
+ return Target : Set do
+ Target.Reserve_Capacity (C);
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
---------------
-- Copy_Node --
---------------
diff --git a/gcc/ada/a-cihase.ads b/gcc/ada/a-cihase.ads
index 860034469ea..33994cdeffa 100644
--- a/gcc/ada/a-cihase.ads
+++ b/gcc/ada/a-cihase.ads
@@ -153,6 +153,10 @@ package Ada.Containers.Indefinite_Hashed_Sets is
Position : Cursor)
return Constant_Reference_Type;
+ procedure Assign (Target : in out Set; Source : Set);
+
+ function Copy (Source : Set; Capacity : Count_Type := 0) return Set;
+
procedure Move (Target : in out Set; Source : in out Set);
-- Clears Target (if it's not empty), and then moves (not copies) the
-- buckets array and nodes from Source to Target.
diff --git a/gcc/ada/a-ciorma.adb b/gcc/ada/a-ciorma.adb
index 3de57c76aa4..cd95b9fd5ab 100644
--- a/gcc/ada/a-ciorma.adb
+++ b/gcc/ada/a-ciorma.adb
@@ -35,6 +35,8 @@ pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Operations);
with Ada.Containers.Red_Black_Trees.Generic_Keys;
pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Keys);
+with System; use type System.Address;
+
package body Ada.Containers.Indefinite_Ordered_Maps is
pragma Suppress (All_Checks);
@@ -287,6 +289,37 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
Adjust (Container.Tree);
end Adjust;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Map; Source : Map) is
+ procedure Insert_Item (Node : Node_Access);
+ pragma Inline (Insert_Item);
+
+ procedure Insert_Items is
+ new Tree_Operations.Generic_Iteration (Insert_Item);
+
+ -----------------
+ -- Insert_Item --
+ -----------------
+
+ procedure Insert_Item (Node : Node_Access) is
+ begin
+ Target.Insert (Key => Node.Key.all, New_Item => Node.Element.all);
+ end Insert_Item;
+
+ -- Start of processing for Assign
+
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Insert_Items (Target.Tree);
+ end Assign;
+
-------------
-- Ceiling --
-------------
@@ -340,6 +373,17 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
return Find (Container, Key) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy (Source : Map) return Map is
+ begin
+ return Target : Map do
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
---------------
-- Copy_Node --
---------------
diff --git a/gcc/ada/a-ciorma.ads b/gcc/ada/a-ciorma.ads
index b31dc0d2e25..1c19b81161f 100644
--- a/gcc/ada/a-ciorma.ads
+++ b/gcc/ada/a-ciorma.ads
@@ -96,6 +96,10 @@ package Ada.Containers.Indefinite_Ordered_Maps is
Process : not null access procedure (Key : Key_Type;
Element : in out Element_Type));
+ procedure Assign (Target : in out Map; Source : Map);
+
+ function Copy (Source : Map) return Map;
+
procedure Move (Target : in out Map; Source : in out Map);
procedure Insert
diff --git a/gcc/ada/a-ciormu.adb b/gcc/ada/a-ciormu.adb
index 8c7055b2fef..e11d5045135 100644
--- a/gcc/ada/a-ciormu.adb
+++ b/gcc/ada/a-ciormu.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2011, 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- --
@@ -38,6 +38,8 @@ pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Keys);
with Ada.Containers.Red_Black_Trees.Generic_Set_Operations;
pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Set_Operations);
+with System; use type System.Address;
+
package body Ada.Containers.Indefinite_Ordered_Multisets is
-----------------------------
@@ -298,6 +300,20 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
Adjust (Container.Tree);
end Adjust;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Set; Source : Set) is
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Target.Union (Source);
+ end Assign;
+
-------------
-- Ceiling --
-------------
@@ -344,6 +360,17 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
return Find (Container, Item) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy (Source : Set) return Set is
+ begin
+ return Target : Set do
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
---------------
-- Copy_Node --
---------------
diff --git a/gcc/ada/a-ciormu.ads b/gcc/ada/a-ciormu.ads
index 80e21662b29..c1d81d5b753 100644
--- a/gcc/ada/a-ciormu.ads
+++ b/gcc/ada/a-ciormu.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2011, 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- --
@@ -118,6 +118,10 @@ package Ada.Containers.Indefinite_Ordered_Multisets is
-- change the value of the element while Process is executing (to "tamper
-- with elements") will raise Program_Error.
+ procedure Assign (Target : in out Set; Source : Set);
+
+ function Copy (Source : Set) return Set;
+
procedure Move (Target : in out Set; Source : in out Set);
-- If Target denotes the same object as Source, the operation does
-- nothing. If either Target or Source is busy (cursor tampering is
diff --git a/gcc/ada/a-ciorse.adb b/gcc/ada/a-ciorse.adb
index 4257f0974e6..56c33cfe670 100644
--- a/gcc/ada/a-ciorse.adb
+++ b/gcc/ada/a-ciorse.adb
@@ -38,6 +38,8 @@ pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Set_Operations);
with Ada.Unchecked_Deallocation;
+with System; use type System.Address;
+
package body Ada.Containers.Indefinite_Ordered_Sets is
type Iterator is new
@@ -321,6 +323,20 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
Adjust (Container.Tree);
end Adjust;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Set; Source : Set) is
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Target.Union (Source);
+ end Assign;
+
-------------
-- Ceiling --
-------------
@@ -363,6 +379,17 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
return Find (Container, Item) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy (Source : Set) return Set is
+ begin
+ return Target : Set do
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
---------------
-- Copy_Node --
---------------
diff --git a/gcc/ada/a-ciorse.ads b/gcc/ada/a-ciorse.ads
index f397f1d464e..c0ead018bb2 100644
--- a/gcc/ada/a-ciorse.ads
+++ b/gcc/ada/a-ciorse.ads
@@ -111,6 +111,10 @@ package Ada.Containers.Indefinite_Ordered_Sets is
(Position : Cursor;
Process : not null access procedure (Element : Element_Type));
+ procedure Assign (Target : in out Set; Source : Set);
+
+ function Copy (Source : Set) return Set;
+
procedure Move (Target : in out Set; Source : in out Set);
procedure Insert
diff --git a/gcc/ada/a-cohama.adb b/gcc/ada/a-cohama.adb
index c06ba9e35e4..20e10e8daf9 100644
--- a/gcc/ada/a-cohama.adb
+++ b/gcc/ada/a-cohama.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2011, 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- --
@@ -35,6 +35,8 @@ pragma Elaborate_All (Ada.Containers.Hash_Tables.Generic_Operations);
with Ada.Containers.Hash_Tables.Generic_Keys;
pragma Elaborate_All (Ada.Containers.Hash_Tables.Generic_Keys);
+with System; use type System.Address;
+
package body Ada.Containers.Hashed_Maps is
type Iterator is new
@@ -131,6 +133,41 @@ package body Ada.Containers.Hashed_Maps is
HT_Ops.Adjust (Container.HT);
end Adjust;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Map; Source : Map) is
+ procedure Insert_Item (Node : Node_Access);
+ pragma Inline (Insert_Item);
+
+ procedure Insert_Items is new HT_Ops.Generic_Iteration (Insert_Item);
+
+ -----------------
+ -- Insert_Item --
+ -----------------
+
+ procedure Insert_Item (Node : Node_Access) is
+ begin
+ Target.Insert (Key => Node.Key, New_Item => Node.Element);
+ end Insert_Item;
+
+ -- Start of processing for Assign
+
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+
+ if Target.Capacity < Source.Length then
+ Target.Reserve_Capacity (Source.Length);
+ end if;
+
+ Insert_Items (Target.HT);
+ end Assign;
+
--------------
-- Capacity --
--------------
@@ -158,6 +195,34 @@ package body Ada.Containers.Hashed_Maps is
return Find (Container, Key) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy
+ (Source : Map;
+ Capacity : Count_Type := 0) return Map
+ is
+ C : Count_Type;
+
+ begin
+ if Capacity = 0 then
+ C := Source.Length;
+
+ elsif Capacity >= Source.Length then
+ C := Capacity;
+
+ else
+ raise Capacity_Error
+ with "Requested capacity is less than Source length";
+ end if;
+
+ return Target : Map do
+ Target.Reserve_Capacity (C);
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
---------------
-- Copy_Node --
---------------
diff --git a/gcc/ada/a-cohama.ads b/gcc/ada/a-cohama.ads
index 0d614bd4f8f..62773833246 100644
--- a/gcc/ada/a-cohama.ads
+++ b/gcc/ada/a-cohama.ads
@@ -148,6 +148,10 @@ package Ada.Containers.Hashed_Maps is
-- Calls Process with the key (with only a constant view) and element (with
-- a variable view) of the node designed by the cursor.
+ procedure Assign (Target : in out Map; Source : Map);
+
+ function Copy (Source : Map; Capacity : Count_Type := 0) return Map;
+
procedure Move (Target : in out Map; Source : in out Map);
-- Clears Target (if it's not empty), and then moves (not copies) the
-- buckets array and nodes from Source to Target.
diff --git a/gcc/ada/a-cohase.adb b/gcc/ada/a-cohase.adb
index 643dde5d964..e0b2345234b 100644
--- a/gcc/ada/a-cohase.adb
+++ b/gcc/ada/a-cohase.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2011, 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- --
@@ -159,6 +159,16 @@ package body Ada.Containers.Hashed_Sets is
Node.Element := Item;
end Assign;
+ procedure Assign (Target : in out Set; Source : Set) is
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Target.Union (Source);
+ end Assign;
+
--------------
-- Capacity --
--------------
@@ -186,6 +196,34 @@ package body Ada.Containers.Hashed_Sets is
return Find (Container, Item) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy
+ (Source : Set;
+ Capacity : Count_Type := 0) return Set
+ is
+ C : Count_Type;
+
+ begin
+ if Capacity = 0 then
+ C := Source.Length;
+
+ elsif Capacity >= Source.Length then
+ C := Capacity;
+
+ else
+ raise Capacity_Error
+ with "Requested capacity is less than Source length";
+ end if;
+
+ return Target : Set do
+ Target.Reserve_Capacity (C);
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
---------------
-- Copy_Node --
---------------
diff --git a/gcc/ada/a-cohase.ads b/gcc/ada/a-cohase.ads
index a262dded097..0bb370bfe83 100644
--- a/gcc/ada/a-cohase.ads
+++ b/gcc/ada/a-cohase.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2011, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -133,6 +133,10 @@ package Ada.Containers.Hashed_Sets is
-- Calls Process with the element (having only a constant view) of the node
-- designed by the cursor.
+ procedure Assign (Target : in out Set; Source : Set);
+
+ function Copy (Source : Set; Capacity : Count_Type := 0) return Set;
+
procedure Move (Target : in out Set; Source : in out Set);
-- Clears Target (if it's not empty), and then moves (not copies) the
-- buckets array and nodes from Source to Target.
diff --git a/gcc/ada/a-coinve.adb b/gcc/ada/a-coinve.adb
index 3172bd2c7b5..ae72e65ed51 100644
--- a/gcc/ada/a-coinve.adb
+++ b/gcc/ada/a-coinve.adb
@@ -616,6 +616,20 @@ package body Ada.Containers.Indefinite_Vectors is
Count);
end Append;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Vector; Source : Vector) is
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Target.Append (Source);
+ end Assign;
+
--------------
-- Capacity --
--------------
@@ -698,6 +712,34 @@ package body Ada.Containers.Indefinite_Vectors is
return Find_Index (Container, Item) /= No_Index;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy
+ (Source : Vector;
+ Capacity : Count_Type := 0) return Vector
+ is
+ C : Count_Type;
+
+ begin
+ if Capacity = 0 then
+ C := Source.Length;
+
+ elsif Capacity >= Source.Length then
+ C := Capacity;
+
+ else
+ raise Capacity_Error
+ with "Requested capacity is less than Source length";
+ end if;
+
+ return Target : Vector do
+ Target.Reserve_Capacity (C);
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
------------
-- Delete --
------------
diff --git a/gcc/ada/a-coinve.ads b/gcc/ada/a-coinve.ads
index a13003819b0..06568278997 100644
--- a/gcc/ada/a-coinve.ads
+++ b/gcc/ada/a-coinve.ads
@@ -204,6 +204,10 @@ package Ada.Containers.Indefinite_Vectors is
Position : Cursor;
Process : not null access procedure (Element : in out Element_Type));
+ procedure Assign (Target : in out Vector; Source : Vector);
+
+ function Copy (Source : Vector; Capacity : Count_Type := 0) return Vector;
+
procedure Move (Target : in out Vector; Source : in out Vector);
procedure Insert
diff --git a/gcc/ada/a-convec.adb b/gcc/ada/a-convec.adb
index a57f7fbd9a8..b18de68a737 100644
--- a/gcc/ada/a-convec.adb
+++ b/gcc/ada/a-convec.adb
@@ -432,6 +432,20 @@ package body Ada.Containers.Vectors is
Count);
end Append;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Vector; Source : Vector) is
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Target.Append (Source);
+ end Assign;
+
--------------
-- Capacity --
--------------
@@ -471,6 +485,34 @@ package body Ada.Containers.Vectors is
return Find_Index (Container, Item) /= No_Index;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy
+ (Source : Vector;
+ Capacity : Count_Type := 0) return Vector
+ is
+ C : Count_Type;
+
+ begin
+ if Capacity = 0 then
+ C := Source.Length;
+
+ elsif Capacity >= Source.Length then
+ C := Capacity;
+
+ else
+ raise Capacity_Error
+ with "Requested capacity is less than Source length";
+ end if;
+
+ return Target : Vector do
+ Target.Reserve_Capacity (C);
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
------------
-- Delete --
------------
diff --git a/gcc/ada/a-convec.ads b/gcc/ada/a-convec.ads
index c90cf01bde9..9eb82c791fe 100644
--- a/gcc/ada/a-convec.ads
+++ b/gcc/ada/a-convec.ads
@@ -202,7 +202,12 @@ package Ada.Containers.Vectors is
function Reference (Container : Vector; Position : Index_Type)
return Reference_Type;
+ procedure Assign (Target : in out Vector; Source : Vector);
+
+ function Copy (Source : Vector; Capacity : Count_Type := 0) return Vector;
+
procedure Move (Target : in out Vector; Source : in out Vector);
+
procedure Insert
(Container : in out Vector;
Before : Extended_Index;
diff --git a/gcc/ada/a-coorma.adb b/gcc/ada/a-coorma.adb
index c1ae68297b3..e8099c3c297 100644
--- a/gcc/ada/a-coorma.adb
+++ b/gcc/ada/a-coorma.adb
@@ -35,6 +35,8 @@ pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Operations);
with Ada.Containers.Red_Black_Trees.Generic_Keys;
pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Keys);
+with System; use type System.Address;
+
package body Ada.Containers.Ordered_Maps is
type Iterator is new
@@ -248,6 +250,37 @@ package body Ada.Containers.Ordered_Maps is
Adjust (Container.Tree);
end Adjust;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Map; Source : Map) is
+ procedure Insert_Item (Node : Node_Access);
+ pragma Inline (Insert_Item);
+
+ procedure Insert_Items is
+ new Tree_Operations.Generic_Iteration (Insert_Item);
+
+ -----------------
+ -- Insert_Item --
+ -----------------
+
+ procedure Insert_Item (Node : Node_Access) is
+ begin
+ Target.Insert (Key => Node.Key, New_Item => Node.Element);
+ end Insert_Item;
+
+ -- Start of processing for Assign
+
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Insert_Items (Target.Tree);
+ end Assign;
+
-------------
-- Ceiling --
-------------
@@ -304,6 +337,17 @@ package body Ada.Containers.Ordered_Maps is
return Find (Container, Key) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy (Source : Map) return Map is
+ begin
+ return Target : Map do
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
---------------
-- Copy_Node --
---------------
diff --git a/gcc/ada/a-coorma.ads b/gcc/ada/a-coorma.ads
index 6fd45b78253..53942b71fa2 100644
--- a/gcc/ada/a-coorma.ads
+++ b/gcc/ada/a-coorma.ads
@@ -96,6 +96,10 @@ package Ada.Containers.Ordered_Maps is
Process : not null access
procedure (Key : Key_Type; Element : in out Element_Type));
+ procedure Assign (Target : in out Map; Source : Map);
+
+ function Copy (Source : Map) return Map;
+
procedure Move (Target : in out Map; Source : in out Map);
procedure Insert
diff --git a/gcc/ada/a-coormu.adb b/gcc/ada/a-coormu.adb
index b59f6f554ef..2ed14819243 100644
--- a/gcc/ada/a-coormu.adb
+++ b/gcc/ada/a-coormu.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2011, 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- --
@@ -38,6 +38,8 @@ pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Keys);
with Ada.Containers.Red_Black_Trees.Generic_Set_Operations;
pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Set_Operations);
+with System; use type System.Address;
+
package body Ada.Containers.Ordered_Multisets is
-----------------------------
@@ -266,6 +268,20 @@ package body Ada.Containers.Ordered_Multisets is
Adjust (Container.Tree);
end Adjust;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Set; Source : Set) is
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Target.Union (Source);
+ end Assign;
+
-------------
-- Ceiling --
-------------
@@ -312,6 +328,17 @@ package body Ada.Containers.Ordered_Multisets is
return Find (Container, Item) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy (Source : Set) return Set is
+ begin
+ return Target : Set do
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
---------------
-- Copy_Node --
---------------
diff --git a/gcc/ada/a-coormu.ads b/gcc/ada/a-coormu.ads
index bcc6eb5e9b8..6f9e3d0b2d8 100644
--- a/gcc/ada/a-coormu.ads
+++ b/gcc/ada/a-coormu.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2011, 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- --
@@ -117,6 +117,10 @@ package Ada.Containers.Ordered_Multisets is
-- change the value of the element while Process is executing (to "tamper
-- with elements") will raise Program_Error.
+ procedure Assign (Target : in out Set; Source : Set);
+
+ function Copy (Source : Set) return Set;
+
procedure Move (Target : in out Set; Source : in out Set);
-- If Target denotes the same object as Source, the operation does
-- nothing. If either Target or Source is busy (cursor tampering is
diff --git a/gcc/ada/a-coorse.adb b/gcc/ada/a-coorse.adb
index 915eed62117..4c6476864b8 100644
--- a/gcc/ada/a-coorse.adb
+++ b/gcc/ada/a-coorse.adb
@@ -38,6 +38,8 @@ pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Keys);
with Ada.Containers.Red_Black_Trees.Generic_Set_Operations;
pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Set_Operations);
+with System; use type System.Address;
+
package body Ada.Containers.Ordered_Sets is
type Iterator is new
@@ -281,6 +283,20 @@ package body Ada.Containers.Ordered_Sets is
Adjust (Container.Tree);
end Adjust;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Set; Source : Set) is
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Target.Union (Source);
+ end Assign;
+
-------------
-- Ceiling --
-------------
@@ -325,6 +341,17 @@ package body Ada.Containers.Ordered_Sets is
return Find (Container, Item) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy (Source : Set) return Set is
+ begin
+ return Target : Set do
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
---------------
-- Copy_Node --
---------------
diff --git a/gcc/ada/a-coorse.ads b/gcc/ada/a-coorse.ads
index 8349ef85fb4..45e6ab90a73 100644
--- a/gcc/ada/a-coorse.ads
+++ b/gcc/ada/a-coorse.ads
@@ -113,6 +113,10 @@ package Ada.Containers.Ordered_Sets is
(Position : Cursor;
Process : not null access procedure (Element : Element_Type));
+ procedure Assign (Target : in out Set; Source : Set);
+
+ function Copy (Source : Set) return Set;
+
procedure Move (Target : in out Set; Source : in out Set);
procedure Insert
diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb
index d75fe06c51b..e99d8753a9e 100644
--- a/gcc/ada/bindgen.adb
+++ b/gcc/ada/bindgen.adb
@@ -1050,9 +1050,8 @@ package body Bindgen is
or else U.Unit_Kind /= 's')
then
- -- The only case in which we have to do something is if this
- -- is a body, with a separate spec, where the separate spec
- -- has an elaboration entity defined. In that case, this is
+ -- In the case of a body with a separate spec, where the
+ -- separate spec has an elaboration entity defined, this is
-- where we increment the elaboration entity.
if U.Utype = Is_Body
@@ -1065,6 +1064,23 @@ package body Bindgen is
Set_Unit_Number (Unum_Spec);
Set_String (" + 1;");
Write_Statement_Buffer;
+
+ -- In the special case where the target is AAMP and the unit is
+ -- a spec with a body, the elaboration entity is initialized
+ -- here. This is done because it's the only way to accomplish
+ -- initialization of such entities, because there's not any
+ -- mechanism provided to initialize global variables at load
+ -- time on AAMP. (Also note that there is no notion of shared
+ -- libraries for AAMP, so no possibility of reelaboration.)
+
+ elsif AAMP_On_Target
+ and then U.Utype = Is_Spec
+ and then Units.Table (Unum_Spec).Set_Elab_Entity
+ then
+ Set_String (" E");
+ Set_Unit_Number (Unum_Spec);
+ Set_String (" := 0;");
+ Write_Statement_Buffer;
end if;
-- Here if elaboration code is present. If binding a library
@@ -1087,6 +1103,24 @@ package body Bindgen is
-- variables, only calls to 'Elab* subprograms.
else
+ -- In the special case where the target is AAMP and the unit is
+ -- a spec with a body, the elaboration entity is initialized
+ -- here. This is done because it's the only way to accomplish
+ -- initialization of such entities, because there's not any
+ -- mechanism provided to initialize global variables at load
+ -- time on AAMP. (Also note that there is no notion of shared
+ -- libraries for AAMP, so no possibility of reelaboration.)
+
+ if AAMP_On_Target
+ and then U.Utype = Is_Spec
+ and then Units.Table (Unum_Spec).Set_Elab_Entity
+ then
+ Set_String (" E");
+ Set_Unit_Number (Unum_Spec);
+ Set_String (" := 0;");
+ Write_Statement_Buffer;
+ end if;
+
Check_Elab_Flag :=
not CodePeer_Mode
and then (Force_Checking_Of_Elaboration_Flags
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index e62629e2a22..e51b8029803 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -7549,16 +7549,14 @@ package body Sem_Ch12 is
Scop := Scope (Scop);
end loop;
- if Scop = Par_I then
-
- -- Previous instance encloses current instance
+ -- Previous instance encloses current instance
+ if Scop = Par_I then
null;
- elsif Is_Generic_Instance (Scop) then
-
- -- Current instance is within an unrelated instance
+ -- Current instance is within an unrelated instance
+ elsif Is_Generic_Instance (Scop) then
null;
else