summaryrefslogtreecommitdiff
path: root/gcc/ada/a-coinve.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-01-30 12:16:12 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-01-30 12:16:12 +0000
commit9deff0440802c41fcd72b87c06d9e1fb3e00a773 (patch)
tree730ae33dd755090612107ccf0b26ffa6e7221022 /gcc/ada/a-coinve.adb
parentc34ce5222778a596f52797d4c5557343c156815e (diff)
downloadgcc-9deff0440802c41fcd72b87c06d9e1fb3e00a773.tar.gz
2012-01-30 Robert Dewar <dewar@adacore.com>
* sem.adb (Analyze): Call Analyze_Mod for N_Op_Mod mode. * sem_ch3.adb (Modular_Type_Declaration): Warn on mod value of form 2 * small-literal. * sem_ch4.adb (Analyze_Mod): New procedure (warn on suspicious mod value). * sem_ch4.ads (Analyze_Mod): New procedure. 2012-01-30 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb: sem_ch6.adb (Analyze_Expression_Function): Copy types and return expression when building spec for implicit body, to preserve global references that may be present in an instantiation. 2012-01-30 Matthew Heaney <heaney@adacore.com> * a-convec.adb, a-coinve.adb, a-cobove.adb (Sort, Reverse_Elements): Check for cursor tampering. 2012-01-30 Ed Schonberg <schonberg@adacore.com> * sem_util.adb (Is_Fully_Initialized_Type): In Ada 2012, a type with aspect Default_Value or Default_Component_Value is fully initialized, and use of variables of such types do not generate warnings. 2012-01-30 Vincent Celier <celier@adacore.com> * projects.texi: Add documentation for attribute Interfaces. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183714 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-coinve.adb')
-rw-r--r--gcc/ada/a-coinve.adb33
1 files changed, 27 insertions, 6 deletions
diff --git a/gcc/ada/a-coinve.adb b/gcc/ada/a-coinve.adb
index 92c08749d9a..ef5389f95a3 100644
--- a/gcc/ada/a-coinve.adb
+++ b/gcc/ada/a-coinve.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2012, 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- --
@@ -1396,7 +1396,6 @@ package body Ada.Containers.Indefinite_Vectors is
----------
procedure Sort (Container : in out Vector) is
-
procedure Sort is new Generic_Array_Sort
(Index_Type => Index_Type,
Element_Type => Element_Access,
@@ -1410,9 +1409,20 @@ package body Ada.Containers.Indefinite_Vectors is
return;
end if;
- if Container.Lock > 0 then
+ -- The exception behavior for the vector container must match that
+ -- for the list container, so we check for cursor tampering here
+ -- (which will catch more things) instead of for element tampering
+ -- (which will catch fewer things). It's true that the elements of
+ -- this vector container could be safely moved around while (say) an
+ -- iteration is taking place (iteration only increments the busy
+ -- counter), and so technically all we would need here is a test for
+ -- element tampering (indicated by the lock counter), that's simply
+ -- an artifact of our array-based implementation. Logically Sort
+ -- requires a check for cursor tampering.
+
+ if Container.Busy > 0 then
raise Program_Error with
- "attempt to tamper with elements (vector is locked)";
+ "attempt to tamper with cursors (vector is busy)";
end if;
Sort (Container.Elements.EA (Index_Type'First .. Container.Last));
@@ -3417,9 +3427,20 @@ package body Ada.Containers.Indefinite_Vectors is
return;
end if;
- if Container.Lock > 0 then
+ -- The exception behavior for the vector container must match that for
+ -- the list container, so we check for cursor tampering here (which will
+ -- catch more things) instead of for element tampering (which will catch
+ -- fewer things). It's true that the elements of this vector container
+ -- could be safely moved around while (say) an iteration is taking place
+ -- (iteration only increments the busy counter), and so technically all
+ -- we would need here is a test for element tampering (indicated by the
+ -- lock counter), that's simply an artifact of our array-based
+ -- implementation. Logically Reverse_Elements requires a check for
+ -- cursor tampering.
+
+ if Container.Busy > 0 then
raise Program_Error with
- "attempt to tamper with elements (vector is locked)";
+ "attempt to tamper with cursors (vector is busy)";
end if;
declare