summaryrefslogtreecommitdiff
path: root/gcc/ada/a-coinve.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-20 10:23:46 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-20 10:23:46 +0000
commitaae9bc79154afb2fc82da451745affd9f0dd1166 (patch)
tree5d28f19aa90d6e4079a4f3107278c6be82f787be /gcc/ada/a-coinve.adb
parenta738763ee9394321fa868afd00cdf04a9a75840f (diff)
downloadgcc-aae9bc79154afb2fc82da451745affd9f0dd1166.tar.gz
2015-10-20 Bob Duff <duff@adacore.com>
* sem_ch13.adb (Analyze_One_Aspect): Avoid analyzing the expression in a 'Disable_Controlled attribute when Expander_Active is False, because otherwise, we get errors about nonstatic expressions in pragma-Preelaborate generic packages. * restrict.ads: minor whitespace cleanup in comment 2015-10-20 Bob Duff <duff@adacore.com> * a-conhel.adb: Remove "use SAC;", because otherwise the compiler complains about use clauses in run-time units. Use "use type" instead. * a-btgbso.adb, a-btgbso.ads, a-cbdlli.adb, a-cbdlli.ads, * a-cbhama.adb, a-cbhama.ads, a-cbhase.adb, a-cbhase.ads, * a-cbmutr.adb, a-cbmutr.ads, a-cborma.adb, a-cborma.ads, * a-cborse.adb, a-cborse.ads, a-cdlili.adb, a-cdlili.ads, * a-chtgbk.adb, a-chtgbk.ads, a-chtgbo.adb, a-chtgbo.ads, * a-chtgke.adb, a-chtgke.ads, a-chtgop.adb, a-chtgop.ads, * a-cidlli.adb, a-cidlli.ads, a-cihama.adb, a-cihama.ads, * a-cihase.adb, a-cihase.ads, a-cimutr.adb, a-cimutr.ads, * a-ciorma.adb, a-ciorma.ads, a-ciormu.adb, a-ciormu.ads, * a-ciorse.adb, a-ciorse.ads, a-cobove.adb, a-cobove.ads, * a-cohama.adb, a-cohama.ads, a-cohase.adb, a-cohase.ads, * a-cohata.ads, a-coinve.adb, a-comutr.adb, a-comutr.ads, * a-convec.adb, a-coorma.adb, a-coorma.ads, a-coormu.adb, * a-coormu.ads, a-coorse.adb, a-coorse.ads, a-crbltr.ads, * a-crbtgk.adb, a-crbtgk.ads, a-crbtgo.adb, a-crbtgo.ads, * a-rbtgbk.adb, a-rbtgbk.ads, a-rbtgbo.adb, a-rbtgbo.ads, * a-rbtgso.adb, a-rbtgso.ads: Change all the predefined containers to share the tampering machinery in Ada.Containers.Helpers. This reduces the amount of duplicated code, and takes advantage of efficiency improvements in Helpers. Protect all run-time checks and supporting machinery with "if Checks" or "if T_Check", so this code can be suppressed with pragma Suppress or -gnatp. Add Pseudo_Reference and Get_Element_Access to remaining containers, so that the compiler can optimize "for ... of" loops. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229041 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-coinve.adb')
-rw-r--r--gcc/ada/a-coinve.adb114
1 files changed, 45 insertions, 69 deletions
diff --git a/gcc/ada/a-coinve.adb b/gcc/ada/a-coinve.adb
index 0f8d04085e4..106178a02bf 100644
--- a/gcc/ada/a-coinve.adb
+++ b/gcc/ada/a-coinve.adb
@@ -38,7 +38,7 @@ package body Ada.Containers.Indefinite_Vectors is
pragma Warnings (Off, "variable ""Busy*"" is not referenced");
pragma Warnings (Off, "variable ""Lock*"" is not referenced");
- -- See comment in Ada.Containers
+ -- See comment in Ada.Containers.Helpers
procedure Free is
new Ada.Unchecked_Deallocation (Elements_Type, Elements_Access);
@@ -304,25 +304,19 @@ package body Ada.Containers.Indefinite_Vectors is
end if;
end if;
- if T_Check then
- declare
- TC : constant Tamper_Counts_Access :=
- Container.TC'Unrestricted_Access;
- begin
- -- The following will raise Constraint_Error if Element is null
-
- return R : constant Constant_Reference_Type :=
- (Element => Container.Elements.EA (Position.Index),
- Control => (Controlled with TC))
- do
- Lock (TC.all);
- end return;
- end;
- else
+ declare
+ TC : constant Tamper_Counts_Access :=
+ Container.TC'Unrestricted_Access;
+ begin
+ -- The following will raise Constraint_Error if Element is null
+
return R : constant Constant_Reference_Type :=
(Element => Container.Elements.EA (Position.Index),
- Control => (Controlled with null));
- end if;
+ Control => (Controlled with TC))
+ do
+ Lock (TC.all);
+ end return;
+ end;
end Constant_Reference;
function Constant_Reference
@@ -334,25 +328,19 @@ package body Ada.Containers.Indefinite_Vectors is
raise Constraint_Error with "Index is out of range";
end if;
- if T_Check then
- declare
- TC : constant Tamper_Counts_Access :=
- Container.TC'Unrestricted_Access;
- begin
- -- The following will raise Constraint_Error if Element is null
-
- return R : constant Constant_Reference_Type :=
- (Element => Container.Elements.EA (Index),
- Control => (Controlled with TC))
- do
- Lock (TC.all);
- end return;
- end;
- else
+ declare
+ TC : constant Tamper_Counts_Access :=
+ Container.TC'Unrestricted_Access;
+ begin
+ -- The following will raise Constraint_Error if Element is null
+
return R : constant Constant_Reference_Type :=
(Element => Container.Elements.EA (Index),
- Control => (Controlled with null));
- end if;
+ Control => (Controlled with TC))
+ do
+ Lock (TC.all);
+ end return;
+ end;
end Constant_Reference;
--------------
@@ -2700,25 +2688,19 @@ package body Ada.Containers.Indefinite_Vectors is
end if;
end if;
- if T_Check then
- declare
- TC : constant Tamper_Counts_Access :=
- Container.TC'Unrestricted_Access;
- begin
- -- The following will raise Constraint_Error if Element is null
-
- return R : constant Reference_Type :=
- (Element => Container.Elements.EA (Position.Index),
- Control => (Controlled with TC))
- do
- Lock (TC.all);
- end return;
- end;
- else
+ declare
+ TC : constant Tamper_Counts_Access :=
+ Container.TC'Unrestricted_Access;
+ begin
+ -- The following will raise Constraint_Error if Element is null
+
return R : constant Reference_Type :=
(Element => Container.Elements.EA (Position.Index),
- Control => (Controlled with null));
- end if;
+ Control => (Controlled with TC))
+ do
+ Lock (TC.all);
+ end return;
+ end;
end Reference;
function Reference
@@ -2730,25 +2712,19 @@ package body Ada.Containers.Indefinite_Vectors is
raise Constraint_Error with "Index is out of range";
end if;
- if T_Check then
- declare
- TC : constant Tamper_Counts_Access :=
- Container.TC'Unrestricted_Access;
- begin
- -- The following will raise Constraint_Error if Element is null
-
- return R : constant Reference_Type :=
- (Element => Container.Elements.EA (Index),
- Control => (Controlled with TC))
- do
- Lock (TC.all);
- end return;
- end;
- else
+ declare
+ TC : constant Tamper_Counts_Access :=
+ Container.TC'Unrestricted_Access;
+ begin
+ -- The following will raise Constraint_Error if Element is null
+
return R : constant Reference_Type :=
(Element => Container.Elements.EA (Index),
- Control => (Controlled with null));
- end if;
+ Control => (Controlled with TC))
+ do
+ Lock (TC.all);
+ end return;
+ end;
end Reference;
---------------------