From eb07c23faa11fbcb74709aee56b0e66a45e949c4 Mon Sep 17 00:00:00 2001 From: charlet Date: Fri, 4 Nov 2011 09:58:07 +0000 Subject: 2011-11-04 Matthew Heaney * 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 * sem_ch12.adb: Minor reformatting 2011-11-04 Gary Dismukes * bindgen.adb (Gen_Elab_Calls): In the case of the AAMP target, initialize elaboration entities to zero when specs are processed. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180930 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/a-cohase.adb | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'gcc/ada/a-cohase.adb') 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 -- --------------- -- cgit v1.2.1