diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-07-16 15:53:37 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-07-16 15:53:37 +0200 |
commit | ab4766388256f3a8b070872bd0af94056afb5417 (patch) | |
tree | 4411672446c3d5a0beded559300f272f3861e178 | |
parent | 3a859cff11c42d863dc37bca68290a308ccfa60c (diff) | |
download | gcc-ab4766388256f3a8b070872bd0af94056afb5417.zip gcc-ab4766388256f3a8b070872bd0af94056afb5417.tar.gz gcc-ab4766388256f3a8b070872bd0af94056afb5417.tar.bz2 |
[multiple changes]
2014-07-16 Robert Dewar <dewar@adacore.com>
* a-coinho.adb, a-coinho-shared.adb, a-coinho-shared.ads: Minor
reformatting.
2014-07-16 Ed Schonberg <schonberg@adacore.com>
* a-cohase.ads: Type Iterator must be controlled, so that the
tampering bit is properly set through an iteration.
* a-cohase.adb: Add Finalize operation for type Iterator.
From-SVN: r212643
-rw-r--r-- | gcc/ada/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/ada/a-cohase.adb | 19 | ||||
-rw-r--r-- | gcc/ada/a-cohase.ads | 7 | ||||
-rw-r--r-- | gcc/ada/a-coinho-shared.adb | 9 | ||||
-rw-r--r-- | gcc/ada/a-coinho-shared.ads | 3 | ||||
-rw-r--r-- | gcc/ada/a-coinho.adb | 2 |
6 files changed, 38 insertions, 13 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e18dff0..2ff7226 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,14 @@ +2014-07-16 Robert Dewar <dewar@adacore.com> + + * a-coinho.adb, a-coinho-shared.adb, a-coinho-shared.ads: Minor + reformatting. + +2014-07-16 Ed Schonberg <schonberg@adacore.com> + + * a-cohase.ads: Type Iterator must be controlled, so that the + tampering bit is properly set through an iteration. + * a-cohase.adb: Add Finalize operation for type Iterator. + 2014-07-16 Ed Schonberg <schonberg@adacore.com> * a-coinho-shared.adb, a-coinho-shared.ads: Proper structures for diff --git a/gcc/ada/a-cohase.adb b/gcc/ada/a-cohase.adb index 129ad6a..1c3db68 100644 --- a/gcc/ada/a-cohase.adb +++ b/gcc/ada/a-cohase.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2014, 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- -- @@ -601,6 +601,17 @@ package body Ada.Containers.Hashed_Sets is end if; end Finalize; + procedure Finalize (Object : in out Iterator) is + begin + if Object.Container /= null then + declare + B : Natural renames Object.Container.HT.Busy; + begin + B := B - 1; + end; + end if; + end Finalize; + ---------- -- Find -- ---------- @@ -1029,8 +1040,12 @@ package body Ada.Containers.Hashed_Sets is function Iterate (Container : Set) return Set_Iterator_Interfaces.Forward_Iterator'Class is + B : Natural renames Container'Unrestricted_Access.all.HT.Busy; begin - return Iterator'(Container => Container'Unrestricted_Access); + B := B + 1; + return It : constant Iterator := + Iterator'(Limited_Controlled with + Container => Container'Unrestricted_Access); end Iterate; ------------ diff --git a/gcc/ada/a-cohase.ads b/gcc/ada/a-cohase.ads index 2931800..9e4ebc1 100644 --- a/gcc/ada/a-cohase.ads +++ b/gcc/ada/a-cohase.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2004-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2014, 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 -- @@ -543,8 +543,8 @@ private No_Element : constant Cursor := (Container => null, Node => null); - type Iterator is limited new - Set_Iterator_Interfaces.Forward_Iterator with record + type Iterator is new Limited_Controlled + and Set_Iterator_Interfaces.Forward_Iterator with record Container : Set_Access; end record; @@ -553,5 +553,6 @@ private overriding function Next (Object : Iterator; Position : Cursor) return Cursor; + overriding procedure Finalize (Object : in out Iterator); end Ada.Containers.Hashed_Sets; diff --git a/gcc/ada/a-coinho-shared.adb b/gcc/ada/a-coinho-shared.adb index c9f117e..df2d55a 100644 --- a/gcc/ada/a-coinho-shared.adb +++ b/gcc/ada/a-coinho-shared.adb @@ -38,12 +38,13 @@ package body Ada.Containers.Indefinite_Holders is function "=" (Left, Right : Holder) return Boolean is begin - if Left.Reference = null and Right.Reference = null then + if Left.Reference = Right.Reference then + -- Covers both null and not null but the same shared object cases. + return True; elsif Left.Reference /= null and Right.Reference /= null then return Left.Reference.Element.all = Right.Reference.Element.all; - else return False; end if; @@ -66,6 +67,7 @@ package body Ada.Containers.Indefinite_Holders is begin if Control.Container /= null then Reference (Control.Container.Reference); + declare B : Natural renames Control.Container.Busy; begin @@ -122,10 +124,9 @@ package body Ada.Containers.Indefinite_Holders is (Element => Container.Reference.Element.all'Access, Control => (Controlled with Container'Unrestricted_Access)); B : Natural renames Ref.Control.Container.Busy; - begin Reference (Ref.Control.Container.Reference); - B := B + 1; + B := B + 1; return Ref; end Constant_Reference; diff --git a/gcc/ada/a-coinho-shared.ads b/gcc/ada/a-coinho-shared.ads index 8294d8e..3e1ed18 100644 --- a/gcc/ada/a-coinho-shared.ads +++ b/gcc/ada/a-coinho-shared.ads @@ -130,8 +130,7 @@ private overriding procedure Adjust (Container : in out Holder); overriding procedure Finalize (Container : in out Holder); - type Reference_Control_Type is new Controlled with - record + type Reference_Control_Type is new Controlled with record Container : Holder_Access; end record; diff --git a/gcc/ada/a-coinho.adb b/gcc/ada/a-coinho.adb index 4cb7179..9fe4c14 100644 --- a/gcc/ada/a-coinho.adb +++ b/gcc/ada/a-coinho.adb @@ -40,10 +40,8 @@ package body Ada.Containers.Indefinite_Holders is begin if Left.Element = null and Right.Element = null then return True; - elsif Left.Element /= null and Right.Element /= null then return Left.Element.all = Right.Element.all; - else return False; end if; |