diff options
author | Ed Schonberg <schonberg@adacore.com> | 2014-07-16 13:52:30 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-07-16 15:52:30 +0200 |
commit | 3a859cff11c42d863dc37bca68290a308ccfa60c (patch) | |
tree | 4f77d0cdf20f0a79577697511b229cb36ee4d995 | |
parent | 88c90b68a0e2ee32ca0613e6d5375e13761266fd (diff) | |
download | gcc-3a859cff11c42d863dc37bca68290a308ccfa60c.zip gcc-3a859cff11c42d863dc37bca68290a308ccfa60c.tar.gz gcc-3a859cff11c42d863dc37bca68290a308ccfa60c.tar.bz2 |
a-coinho-shared.adb, [...]: Proper structures for tampering checks.
2014-07-16 Ed Schonberg <schonberg@adacore.com>
* a-coinho-shared.adb, a-coinho-shared.ads: Proper structures for
tampering checks.
From-SVN: r212642
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/a-coinho-shared.adb | 22 | ||||
-rw-r--r-- | gcc/ada/a-coinho-shared.ads | 3 |
3 files changed, 23 insertions, 7 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index eebff9e..e18dff0 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,10 @@ 2014-07-16 Ed Schonberg <schonberg@adacore.com> + * a-coinho-shared.adb, a-coinho-shared.ads: Proper structures for + tampering checks. + +2014-07-16 Ed Schonberg <schonberg@adacore.com> + * a-coinho-shared.adb: Fix spurious accessibility check. 2014-06-15 Jan Hubicka <hubicka@ucw.cz> diff --git a/gcc/ada/a-coinho-shared.adb b/gcc/ada/a-coinho-shared.adb index 4bcfb71..c9f117e 100644 --- a/gcc/ada/a-coinho-shared.adb +++ b/gcc/ada/a-coinho-shared.adb @@ -65,7 +65,12 @@ package body Ada.Containers.Indefinite_Holders is overriding procedure Adjust (Control : in out Reference_Control_Type) is begin if Control.Container /= null then - Reference (Control.Container); + Reference (Control.Container.Reference); + declare + B : Natural renames Control.Container.Busy; + begin + B := B + 1; + end; end if; end Adjust; @@ -115,9 +120,12 @@ package body Ada.Containers.Indefinite_Holders is is Ref : constant Constant_Reference_Type := (Element => Container.Reference.Element.all'Access, - Control => (Controlled with Container.Reference)); + Control => (Controlled with Container'Unrestricted_Access)); + B : Natural renames Ref.Control.Container.Busy; + begin - Reference (Ref.Control.Container); + Reference (Ref.Control.Container.Reference); + B := B + 1; return Ref; end Constant_Reference; @@ -168,7 +176,8 @@ package body Ada.Containers.Indefinite_Holders is overriding procedure Finalize (Control : in out Reference_Control_Type) is begin if Control.Container /= null then - Unreference (Control.Container); + Unreference (Control.Container.Reference); + Control.Container.Busy := Control.Container.Busy - 1; end if; Control.Container := null; @@ -284,9 +293,10 @@ package body Ada.Containers.Indefinite_Holders is is Ref : constant Reference_Type := (Element => Container.Reference.Element.all'Access, - Control => (Controlled with Container.Reference)); + Control => (Controlled with Container'Unrestricted_Access)); begin - Reference (Ref.Control.Container); + Reference (Ref.Control.Container.Reference); + Container.Busy := Container.Busy + 1; return Ref; end Reference; diff --git a/gcc/ada/a-coinho-shared.ads b/gcc/ada/a-coinho-shared.ads index e97a64a..8294d8e 100644 --- a/gcc/ada/a-coinho-shared.ads +++ b/gcc/ada/a-coinho-shared.ads @@ -97,6 +97,7 @@ private use Ada.Streams; type Element_Access is access all Element_Type; + type Holder_Access is access all Holder; type Shared_Holder is record Counter : System.Atomic_Counters.Atomic_Counter; @@ -131,7 +132,7 @@ private type Reference_Control_Type is new Controlled with record - Container : Shared_Holder_Access; + Container : Holder_Access; end record; overriding procedure Adjust (Control : in out Reference_Control_Type); |