summaryrefslogtreecommitdiffstats
path: root/gcc/ada/a-convec.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-02-08 09:27:17 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-02-08 09:27:17 +0000
commitb55f7641b510c7fd06a7ff9dbb8c173a412f9d43 (patch)
treedc8537cde3046210d1bdc3d08b0d20cde3b64224 /gcc/ada/a-convec.adb
parentcff7d88e0f1e1289cbe11cbffe0b1372fed55389 (diff)
downloadppe42-gcc-b55f7641b510c7fd06a7ff9dbb8c173a412f9d43.tar.gz
ppe42-gcc-b55f7641b510c7fd06a7ff9dbb8c173a412f9d43.zip
2012-02-08 Robert Dewar <dewar@adacore.com>
* a-coinve.adb, sem_util.adb, sem_ch8.adb, a-cobove.adb, a-convec.adb: Minor reformatting and code reorganization. 2012-02-08 Steve Baird <baird@adacore.com> * sem_cat.adb (In_Preelaborated_Unit): A child unit instantiation does not inherit preelaboration requirements from its parent. 2012-02-08 Gary Dismukes <dismukes@adacore.com> * aspects.ads (type Aspect_Id): Add Aspect_Simple_Storage_Pool. (Impl_Defined_Aspects): Add entry for Aspect_Simple_Storage_Pool. (Aspect_Argument): Add Name entry for Aspect_Simple_Storage_Pool. (Aspect_Names): Add entry for Aspect_Simple_Storage_Pool. * aspects.adb (Canonical_Aspect): Add entry for Aspect_Simple_Storage_Pool. * exp_attr.adb (Expand_N_Attribute_Reference): Handle case of Attribute_Simple_Storage_Pool in the same way as Storage_Pool (add conversion, analyze/resolve). For the Storage_Size attribute, for the simple pool case, locate and use the simple pool type's Storage_Size function (if any), otherwise evaluate to zero. * exp_ch4.adb (Expand_N_Allocator): In the case of an allocator for an access type with an associated simple storage pool, locate and use the pool type's Allocate. * exp_intr.adb (Expand_Unc_Deallocation): In the case where the access type has a simple storage pool, locate the pool type's Deallocate procedure (if present) and use it as the procedure to call on the Free operation. * freeze.adb (Freeze_Entity): In the case of a full type for a private type defined with pragma Simple_Storage_Pool, check that the full type is also appropriate for the pragma. For a simple storage pool type, validate that the operations Allocate, Deallocate (if present), and Storage_Size (if present) are defined with appropriate expected profiles. (Validate_Simple_Pool_Op_Formal): New procedure (Validate_Simple_Pool_Operation): New procedure Add with and use of Rtsfind. * par-prag.adb: Add Pragma_Simple_Storage_Pool to case statement (no action required). * sem_attr.adb (Analyze_Attribute): For the case of the Storage_Pool attribute, give a warning if the prefix type has an associated simple storage pool, and rewrite the attribute as a raise of Program_Error. In the case of the Simple_Storage_Pool attribute, check that the prefix type has an associated simple storage pool, and set the attribute type to the pool's type. * sem_ch13.adb (Analyze_Aspect_Specifications): Add Aspect_Simple_Storage_Pool case choice. (Analyze_Attribute_Definition_Clause): Add Aspect_Simple_Storage_Pool to case for Ignore_Rep_Clauses (no action). Add handling for Simple_Storage_Pool attribute definition, requiring the name to denote a simple storage pool object. (Check_Aspect_At_Freeze_Point): For a simple storage pool aspect, set the type to that of the name specified for the aspect. * sem_prag.adb (Analyze_Pragma): Add handling for pragma Simple_Storage_Pool, requiring that it applies to a library-level type declared in a package declaration that is a limited private or limited record type. * sem_res.adb (Resolve_Allocator): Flag an attempt to call a build-in-place function in an allocator for an access type with a simple storage pool as unsupported. * snames.ads-tmpl: Add Name_Simple_Storage_Pool. (type Attribute_Id): Add Attribute_Simple_Storage_Pool. (type Pragma_Id): Add Pragma_Simple_Storage_Pool. * snames.adb-tmpl (Get_Pragma_Id): Handle case of Name_Simple_Storage_Pool. (Is_Pragma_Name): Return True for Name_Simple_Storage_Pool. 2012-02-08 Cyrille Comar <comar@adacore.com> * projects.texi: Clarify doc for interfaces. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183997 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-convec.adb')
-rw-r--r--gcc/ada/a-convec.adb43
1 files changed, 20 insertions, 23 deletions
diff --git a/gcc/ada/a-convec.adb b/gcc/ada/a-convec.adb
index 837c7832f53..729fead732c 100644
--- a/gcc/ada/a-convec.adb
+++ b/gcc/ada/a-convec.adb
@@ -1047,8 +1047,6 @@ package body Ada.Containers.Vectors is
Array_Type => Elements_Array,
"<" => "<");
- -- Start of processing for Sort
-
begin
if Container.Last <= Index_Type'First then
return;
@@ -2994,9 +2992,9 @@ package body Ada.Containers.Vectors is
-- 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
+ -- (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.
@@ -3006,22 +3004,22 @@ package body Ada.Containers.Vectors is
end if;
declare
- I, J : Index_Type;
- E : Elements_Type renames Container.Elements.all;
+ K : Index_Type;
+ J : Index_Type;
+ E : Elements_Type renames Container.Elements.all;
begin
- I := Index_Type'First;
+ K := Index_Type'First;
J := Container.Last;
- while I < J loop
+ while K < J loop
declare
- EI : constant Element_Type := E.EA (I);
-
+ EK : constant Element_Type := E.EA (K);
begin
- E.EA (I) := E.EA (J);
- E.EA (J) := EI;
+ E.EA (K) := E.EA (J);
+ E.EA (J) := EK;
end;
- I := I + 1;
+ K := K + 1;
J := J - 1;
end loop;
end;
@@ -3116,12 +3114,12 @@ package body Ada.Containers.Vectors is
Count : constant Count_Type'Base := Container.Length - Length;
begin
- -- Set_Length allows the user to set the length explicitly, instead of
- -- implicitly as a side-effect of deletion or insertion. If the
+ -- Set_Length allows the user to set the length explicitly, instead
+ -- of implicitly as a side-effect of deletion or insertion. If the
-- requested length is less then the current length, this is equivalent
-- to deleting items from the back end of the vector. If the requested
- -- length is greater than the current length, then this is equivalent to
- -- inserting "space" (nonce items) at the end.
+ -- length is greater than the current length, then this is equivalent
+ -- to inserting "space" (nonce items) at the end.
if Count >= 0 then
Container.Delete_Last (Count);
@@ -3360,6 +3358,7 @@ package body Ada.Containers.Vectors is
end if;
elsif Index_Type'First <= 0 then
+
-- Here we can compute Last directly, in the normal way. We know that
-- No_Index is less than 0, so there is no danger of overflow when
-- adding the (positive) value of Length.
@@ -3440,13 +3439,11 @@ package body Ada.Containers.Vectors is
begin
if Position.Container = null then
raise Constraint_Error with "Position cursor has no element";
- end if;
-
- if Position.Container /= Container'Unrestricted_Access then
+ elsif Position.Container /= Container'Unrestricted_Access then
raise Program_Error with "Position cursor denotes wrong container";
+ else
+ Update_Element (Container, Position.Index, Process);
end if;
-
- Update_Element (Container, Position.Index, Process);
end Update_Element;
-----------
OpenPOWER on IntegriCloud