]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Mon, 12 Dec 2011 11:28:03 +0000 (12:28 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 12 Dec 2011 11:28:03 +0000 (12:28 +0100)
2011-12-12  Tristan Gingold  <gingold@adacore.com>

* mlib-tgt-specific-xi.adb: (Get_Target_Prefix): Simplify code.

2011-12-12  Thomas Quinot  <quinot@adacore.com>

* par_sco.adb: Adjust dominant marker for branches of CASE
statements.

2011-12-12  Thomas Quinot  <quinot@adacore.com>

* gsocket.h, s-oscons-tmplt.c: Ensure we do not include any system
header file prior to redefining FD_SETSIZE.

2011-12-12  Ed Schonberg  <schonberg@adacore.com>

* sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): In
a generic context the aspect expressions may not have been
preanalyzed if there was no previous freeze point, so the
expressions must be preanalyzed now, and there is no conformance
to check for visibility changes.

2011-12-12  Matthew Heaney  <heaney@adacore.com>

* a-convec.adb, a-coinve.adb, a-cobove.adb (Iterator): Use
subtype Index_Type'Base for Index component (Finalize): Remove
unnecessary access check (First, Last): Cursor return value
depends on iterator index value (Iterate): Use start position as
iterator index value (Next, Previous): Forward to corresponding
cursor-based operation.
* a-cborma.adb (Iterate): Properly initialize iterator object (with 0
as node index).

From-SVN: r182226

gcc/ada/ChangeLog
gcc/ada/a-cborma.adb
gcc/ada/a-cobove.adb
gcc/ada/a-coinve.adb
gcc/ada/a-convec.adb
gcc/ada/gsocket.h
gcc/ada/mlib-tgt-specific-xi.adb
gcc/ada/par_sco.adb
gcc/ada/s-oscons-tmplt.c
gcc/ada/sem_ch13.adb

index 167b3f3e4291259b66c0c36d9c4cefb2bd1e070f..84ea178943e5dcb798c3a70863ed764646792340 100644 (file)
@@ -1,3 +1,36 @@
+2011-12-12  Tristan Gingold  <gingold@adacore.com>
+
+       * mlib-tgt-specific-xi.adb: (Get_Target_Prefix): Simplify code.
+
+2011-12-12  Thomas Quinot  <quinot@adacore.com>
+
+       * par_sco.adb: Adjust dominant marker for branches of CASE
+       statements.
+
+2011-12-12  Thomas Quinot  <quinot@adacore.com>
+
+       * gsocket.h, s-oscons-tmplt.c: Ensure we do not include any system
+       header file prior to redefining FD_SETSIZE.
+
+2011-12-12  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): In
+       a generic context the aspect expressions may not have been
+       preanalyzed if there was no previous freeze point, so the
+       expressions must be preanalyzed now, and there is no conformance
+       to check for visibility changes.
+
+2011-12-12  Matthew Heaney  <heaney@adacore.com>
+
+       * a-convec.adb, a-coinve.adb, a-cobove.adb (Iterator): Use
+       subtype Index_Type'Base for Index component (Finalize): Remove
+       unnecessary access check (First, Last): Cursor return value
+       depends on iterator index value (Iterate): Use start position as
+       iterator index value (Next, Previous): Forward to corresponding
+       cursor-based operation.
+       * a-cborma.adb (Iterate): Properly initialize iterator object (with 0
+       as node index).
+
 2011-12-12  Robert Dewar  <dewar@adacore.com>
 
        * par_sco.adb, scos.ads, put_scos.adb, get_scos.adb: Minor reformatting.
index 3e140efbdf5a4b90aaf4811a49e9fdf28e9c0c6a..b39d9ae3a55ca76ddf2e6424a24b6a6e027ba1fb 100644 (file)
@@ -935,7 +935,7 @@ package body Ada.Containers.Bounded_Ordered_Maps is
       return It : constant Iterator :=
                     (Limited_Controlled with
                        Container => Container'Unrestricted_Access,
-                       Node      => Container.First)
+                       Node      => 0)
       do
          B := B + 1;
       end return;
index e9c879d47a5798074a8108c57400c5ac69fde965..ff2dc3729074552462de263477c9946a6e2d4b2f 100644 (file)
@@ -38,7 +38,7 @@ package body Ada.Containers.Bounded_Vectors is
      Vector_Iterator_Interfaces.Reversible_Iterator with
    record
       Container : Vector_Access;
-      Index     : Index_Type;
+      Index     : Index_Type'Base;
    end record;
 
    overriding procedure Finalize (Object : in out Iterator);
@@ -667,14 +667,9 @@ package body Ada.Containers.Bounded_Vectors is
    --------------
 
    procedure Finalize (Object : in out Iterator) is
+      B : Natural renames Object.Container.Busy;
    begin
-      if Object.Container /= null then
-         declare
-            B : Natural renames Object.Container.all.Busy;
-         begin
-            B := B - 1;
-         end;
-      end if;
+      B := B - 1;
    end Finalize;
 
    ----------
@@ -740,10 +735,24 @@ package body Ada.Containers.Bounded_Vectors is
 
    function First (Object : Iterator) return Cursor is
    begin
-      if Is_Empty (Object.Container.all) then
-         return No_Element;
+      --  The value of the iterator object's Index component influences the
+      --  behavior of the First (and Last) selector function.
+
+      --  When the Index component is No_Index, this means the iterator object
+      --  was constructed without a start expression, in which case the
+      --  (forward) iteration starts from the (logical) beginning of the entire
+      --  sequence of items (corresponding to Container.First, for a forward
+      --  iterator).
+
+      --  Otherwise, this is iteration over a partial sequence of items. When
+      --  the Index component isn't No_Index, the iterator object was
+      --  constructed with a start expression, that specifies the position from
+      --  which the (forward) partial iteration begins.
+
+      if Object.Index = No_Index then
+         return First (Object.Container.all);
       else
-         return  Cursor'(Object.Container, Index_Type'First);
+         return Cursor'(Object.Container, Object.Index);
       end if;
    end First;
 
@@ -1648,12 +1657,24 @@ package body Ada.Containers.Bounded_Vectors is
      (Container : Vector)
       return Vector_Iterator_Interfaces.Reversible_Iterator'Class
    is
-      B : Natural renames Container'Unrestricted_Access.all.Busy;
+      V : constant Vector_Access := Container'Unrestricted_Access;
+      B : Natural renames V.Busy;
+
    begin
+      --  The value of its Index component influences the behavior of the First
+      --  and Last selector functions of the iterator object. When the Index
+      --  component is No_Index (as is the case here), this means the iterator
+      --  object was constructed without a start expression. This is a complete
+      --  iterator, meaning that the iteration starts from the (logical)
+      --  beginning of the sequence of items.
+
+      --  Note: For a forward iterator, Container.First is the beginning, and
+      --  for a reverse iterator, Container.Last is the beginning.
+
       return It : constant Iterator :=
-                    Iterator'(Limited_Controlled with
-                                Container => Container'Unrestricted_Access,
-                                Index     => Index_Type'First)
+                    (Limited_Controlled with
+                       Container => V,
+                       Index     => No_Index)
       do
          B := B + 1;
       end return;
@@ -1662,14 +1683,51 @@ package body Ada.Containers.Bounded_Vectors is
    function Iterate
      (Container : Vector;
       Start     : Cursor)
-      return Vector_Iterator_Interfaces.Reversible_Iterator'class
+      return Vector_Iterator_Interfaces.Reversible_Iterator'Class
    is
-      B : Natural renames Container'Unrestricted_Access.all.Busy;
+      V : constant Vector_Access := Container'Unrestricted_Access;
+      B : Natural renames V.Busy;
+
    begin
+      --  It was formerly the case that when Start = No_Element, the partial
+      --  iterator was defined to behave the same as for a complete iterator,
+      --  and iterate over the entire sequence of items. However, those
+      --  semantics were unintuitive and arguably error-prone (it is too easy
+      --  to accidentally create an endless loop), and so they were changed,
+      --  per the ARG meeting in Denver on 2011/11. However, there was no
+      --  consensus about what positive meaning this corner case should have,
+      --  and so it was decided to simply raise an exception. This does imply,
+      --  however, that it is not possible to use a partial iterator to specify
+      --  an empty sequence of items.
+
+      if Start.Container = null then
+         raise Constraint_Error with
+           "Start position for iterator equals No_Element";
+      end if;
+
+      if Start.Container /= V then
+         raise Program_Error with
+           "Start cursor of Iterate designates wrong vector";
+      end if;
+
+      if Start.Index > V.Last then
+         raise Constraint_Error with
+           "Start position for iterator equals No_Element";
+      end if;
+
+      --  The value of its Index component influences the behavior of the First
+      --  and Last selector functions of the iterator object. When the Index
+      --  component is not No_Index (as is the case here), it means that this
+      --  is a partial iteration, over a subset of the complete sequence of
+      --  items. The iterator object was constructed with a start expression,
+      --  indicating the position from which the iteration begins. Note that
+      --  the start position has the same value irrespective of whether this is
+      --  a forward or reverse iteration.
+
       return It : constant Iterator :=
-                    Iterator'(Limited_Controlled with
-                                Container => Container'Unrestricted_Access,
-                                Index     => Start.Index)
+                    (Limited_Controlled with
+                       Container => V,
+                       Index     => Start.Index)
       do
          B := B + 1;
       end return;
@@ -1690,10 +1748,23 @@ package body Ada.Containers.Bounded_Vectors is
 
    function Last (Object : Iterator) return Cursor is
    begin
-      if Is_Empty (Object.Container.all) then
-         return No_Element;
+      --  The value of the iterator object's Index component influences the
+      --  behavior of the Last (and First) selector function.
+
+      --  When the Index component is No_Index, this means the iterator object
+      --  was constructed without a start expression, in which case the
+      --  (reverse) iteration starts from the (logical) beginning of the entire
+      --  sequence (corresponding to Container.Last, for a reverse iterator).
+
+      --  Otherwise, this is iteration over a partial sequence of items. When
+      --  the Index component is not No_Index, the iterator object was
+      --  constructed with a start expression, that specifies the position from
+      --  which the (reverse) partial iteration begins.
+
+      if Object.Index = No_Index then
+         return Last (Object.Container.all);
       else
-         return Cursor'(Object.Container, Object.Container.Last);
+         return Cursor'(Object.Container, Object.Index);
       end if;
    end Last;
 
@@ -1811,11 +1882,16 @@ package body Ada.Containers.Bounded_Vectors is
 
    function Next (Object : Iterator; Position : Cursor) return Cursor is
    begin
-      if Position.Index = Object.Container.Last then
-         return  No_Element;
-      else
-         return (Object.Container, Position.Index + 1);
+      if Position.Container = null then
+         return No_Element;
+      end if;
+
+      if Position.Container /= Object.Container then
+         raise Program_Error with
+           "Position cursor of Next designates wrong vector";
       end if;
+
+      return Next (Position);
    end Next;
 
    procedure Next (Position : in out Cursor) is
@@ -1884,11 +1960,16 @@ package body Ada.Containers.Bounded_Vectors is
 
    function Previous (Object : Iterator; Position : Cursor) return Cursor is
    begin
-      if Position.Index > Index_Type'First then
-         return (Object.Container, Position.Index - 1);
-      else
+      if Position.Container = null then
          return No_Element;
       end if;
+
+      if Position.Container /= Object.Container then
+         raise Program_Error with
+           "Position cursor of Previous designates wrong vector";
+      end if;
+
+      return Previous (Position);
    end Previous;
 
    -------------------
index dca166f495b3a79ad2f6fcd892d1f8895676aae8..fed45faddda912713e19419d4fc75c9d9cb8d58a 100644 (file)
@@ -44,7 +44,7 @@ package body Ada.Containers.Indefinite_Vectors is
      Vector_Iterator_Interfaces.Reversible_Iterator with
    record
       Container : Vector_Access;
-      Index     : Index_Type;
+      Index     : Index_Type'Base;
    end record;
 
    overriding procedure Finalize (Object : in out Iterator);
@@ -1109,14 +1109,9 @@ package body Ada.Containers.Indefinite_Vectors is
    end Finalize;
 
    procedure Finalize (Object : in out Iterator) is
+      B : Natural renames Object.Container.Busy;
    begin
-      if Object.Container /= null then
-         declare
-            B : Natural renames Object.Container.all.Busy;
-         begin
-            B := B - 1;
-         end;
-      end if;
+      B := B - 1;
    end Finalize;
 
    ----------
@@ -1185,9 +1180,26 @@ package body Ada.Containers.Indefinite_Vectors is
    end First;
 
    function First (Object : Iterator) return Cursor is
-      C : constant Cursor := (Object.Container, Index_Type'First);
    begin
-      return C;
+      --  The value of the iterator object's Index component influences the
+      --  behavior of the First (and Last) selector function.
+
+      --  When the Index component is No_Index, this means the iterator object
+      --  was constructed without a start expression, in which case the
+      --  (forward) iteration starts from the (logical) beginning of the entire
+      --  sequence of items (corresponding to Container.First, for a forward
+      --  iterator).
+
+      --  Otherwise, this is iteration over a partial sequence of items. When
+      --  the Index component isn't No_Index, the iterator object was
+      --  constructed with a start expression, that specifies the position from
+      --  which the (forward) partial iteration begins.
+
+      if Object.Index = No_Index then
+         return First (Object.Container.all);
+      else
+         return Cursor'(Object.Container, Object.Index);
+      end if;
    end First;
 
    -------------------
@@ -2552,15 +2564,26 @@ package body Ada.Containers.Indefinite_Vectors is
    end Iterate;
 
    function Iterate (Container : Vector)
-      return Vector_Iterator_Interfaces.Reversible_Iterator'class
+      return Vector_Iterator_Interfaces.Reversible_Iterator'Class
    is
-      B  : Natural renames Container'Unrestricted_Access.all.Busy;
+      V : constant Vector_Access := Container'Unrestricted_Access;
+      B : Natural renames V.Busy;
 
    begin
+      --  The value of its Index component influences the behavior of the First
+      --  and Last selector functions of the iterator object. When the Index
+      --  component is No_Index (as is the case here), this means the iterator
+      --  object was constructed without a start expression. This is a complete
+      --  iterator, meaning that the iteration starts from the (logical)
+      --  beginning of the sequence of items.
+
+      --  Note: For a forward iterator, Container.First is the beginning, and
+      --  for a reverse iterator, Container.Last is the beginning.
+
       return It : constant Iterator :=
                     (Limited_Controlled with
-                       Container => Container'Unrestricted_Access,
-                       Index     => Index_Type'First)
+                       Container => V,
+                       Index     => No_Index)
       do
          B := B + 1;
       end return;
@@ -2569,14 +2592,50 @@ package body Ada.Containers.Indefinite_Vectors is
    function Iterate
      (Container : Vector;
       Start     : Cursor)
-      return Vector_Iterator_Interfaces.Reversible_Iterator'class
+      return Vector_Iterator_Interfaces.Reversible_Iterator'Class
    is
-      B  : Natural renames Container'Unrestricted_Access.all.Busy;
+      V : constant Vector_Access := Container'Unrestricted_Access;
+      B : Natural renames V.Busy;
 
    begin
+      --  It was formerly the case that when Start = No_Element, the partial
+      --  iterator was defined to behave the same as for a complete iterator,
+      --  and iterate over the entire sequence of items. However, those
+      --  semantics were unintuitive and arguably error-prone (it is too easy
+      --  to accidentally create an endless loop), and so they were changed,
+      --  per the ARG meeting in Denver on 2011/11. However, there was no
+      --  consensus about what positive meaning this corner case should have,
+      --  and so it was decided to simply raise an exception. This does imply,
+      --  however, that it is not possible to use a partial iterator to specify
+      --  an empty sequence of items.
+
+      if Start.Container = null then
+         raise Constraint_Error with
+           "Start position for iterator equals No_Element";
+      end if;
+
+      if Start.Container /= V then
+         raise Program_Error with
+           "Start cursor of Iterate designates wrong vector";
+      end if;
+
+      if Start.Index > V.Last then
+         raise Constraint_Error with
+           "Start position for iterator equals No_Element";
+      end if;
+
+      --  The value of its Index component influences the behavior of the First
+      --  and Last selector functions of the iterator object. When the Index
+      --  component is not No_Index (as is the case here), it means that this
+      --  is a partial iteration, over a subset of the complete sequence of
+      --  items. The iterator object was constructed with a start expression,
+      --  indicating the position from which the iteration begins. Note that
+      --  the start position has the same value irrespective of whether this is
+      --  a forward or reverse iteration.
+
       return It : constant Iterator :=
                     (Limited_Controlled with
-                       Container => Container'Unrestricted_Access,
+                       Container => V,
                        Index     => Start.Index)
       do
          B := B + 1;
@@ -2597,9 +2656,25 @@ package body Ada.Containers.Indefinite_Vectors is
    end Last;
 
    function Last (Object : Iterator) return Cursor is
-      C : constant Cursor := (Object.Container, Object.Container.Last);
    begin
-      return C;
+      --  The value of the iterator object's Index component influences the
+      --  behavior of the Last (and First) selector function.
+
+      --  When the Index component is No_Index, this means the iterator object
+      --  was constructed without a start expression, in which case the
+      --  (reverse) iteration starts from the (logical) beginning of the entire
+      --  sequence (corresponding to Container.Last, for a reverse iterator).
+
+      --  Otherwise, this is iteration over a partial sequence of items. When
+      --  the Index component is not No_Index, the iterator object was
+      --  constructed with a start expression, that specifies the position from
+      --  which the (reverse) partial iteration begins.
+
+      if Object.Index = No_Index then
+         return Last (Object.Container.all);
+      else
+         return Cursor'(Object.Container, Object.Index);
+      end if;
    end Last;
 
    -----------------
@@ -2718,11 +2793,16 @@ package body Ada.Containers.Indefinite_Vectors is
 
    function Next (Object : Iterator; Position : Cursor) return Cursor is
    begin
-      if Position.Index = Object.Container.Last then
-         return  No_Element;
-      else
-         return (Object.Container, Position.Index + 1);
+      if Position.Container = null then
+         return No_Element;
       end if;
+
+      if Position.Container /= Object.Container then
+         raise Program_Error with
+           "Position cursor of Next designates wrong vector";
+      end if;
+
+      return Next (Position);
    end Next;
 
    procedure Next (Position : in out Cursor) is
@@ -2791,11 +2871,16 @@ package body Ada.Containers.Indefinite_Vectors is
 
    function Previous (Object : Iterator; Position : Cursor) return Cursor is
    begin
-      if Position.Index > Index_Type'First then
-         return (Object.Container, Position.Index - 1);
-      else
+      if Position.Container = null then
          return No_Element;
       end if;
+
+      if Position.Container /= Object.Container then
+         raise Program_Error with
+           "Position cursor of Previous designates wrong vector";
+      end if;
+
+      return Previous (Position);
    end Previous;
 
    -------------------
index 980708d1f7e20ad02442b65f24b4f6d246dac684..c16c2f66edc2c21bcb9705f4642c1768b2a38275 100644 (file)
@@ -41,16 +41,18 @@ package body Ada.Containers.Vectors is
      Vector_Iterator_Interfaces.Reversible_Iterator with
    record
       Container : Vector_Access;
-      Index     : Index_Type;
+      Index     : Index_Type'Base;
    end record;
 
    overriding procedure Finalize (Object : in out Iterator);
 
    overriding function First (Object : Iterator) return Cursor;
    overriding function Last  (Object : Iterator) return Cursor;
+
    overriding function Next
-     (Object : Iterator;
+     (Object   : Iterator;
       Position : Cursor) return Cursor;
+
    overriding function Previous
      (Object   : Iterator;
       Position : Cursor) return Cursor;
@@ -782,14 +784,9 @@ package body Ada.Containers.Vectors is
    end Finalize;
 
    procedure Finalize (Object : in out Iterator) is
+      B : Natural renames Object.Container.Busy;
    begin
-      if Object.Container /= null then
-         declare
-            B : Natural renames Object.Container.all.Busy;
-         begin
-            B := B - 1;
-         end;
-      end if;
+      B := B - 1;
    end Finalize;
 
    ----------
@@ -855,10 +852,24 @@ package body Ada.Containers.Vectors is
 
    function First (Object : Iterator) return Cursor is
    begin
-      if Is_Empty (Object.Container.all) then
-         return No_Element;
+      --  The value of the iterator object's Index component influences the
+      --  behavior of the First (and Last) selector function.
+
+      --  When the Index component is No_Index, this means the iterator object
+      --  was constructed without a start expression, in which case the
+      --  (forward) iteration starts from the (logical) beginning of the entire
+      --  sequence of items (corresponding to Container.First, for a forward
+      --  iterator).
+
+      --  Otherwise, this is iteration over a partial sequence of items. When
+      --  the Index component isn't No_Index, the iterator object was
+      --  constructed with a start expression, that specifies the position from
+      --  which the (forward) partial iteration begins.
+
+      if Object.Index = No_Index then
+         return First (Object.Container.all);
       else
-         return (Object.Container, Index_Type'First);
+         return Cursor'(Object.Container, Object.Index);
       end if;
    end First;
 
@@ -2124,13 +2135,24 @@ package body Ada.Containers.Vectors is
      (Container : Vector)
       return Vector_Iterator_Interfaces.Reversible_Iterator'Class
    is
-      B  : Natural renames Container'Unrestricted_Access.all.Busy;
+      V : constant Vector_Access := Container'Unrestricted_Access;
+      B : Natural renames V.Busy;
 
    begin
+      --  The value of its Index component influences the behavior of the First
+      --  and Last selector functions of the iterator object. When the Index
+      --  component is No_Index (as is the case here), this means the iterator
+      --  object was constructed without a start expression. This is a complete
+      --  iterator, meaning that the iteration starts from the (logical)
+      --  beginning of the sequence of items.
+
+      --  Note: For a forward iterator, Container.First is the beginning, and
+      --  for a reverse iterator, Container.Last is the beginning.
+
       return It : constant Iterator :=
                     (Limited_Controlled with
-                       Container => Container'Unrestricted_Access,
-                       Index     => Index_Type'First)
+                       Container => V,
+                       Index     => No_Index)
       do
          B := B + 1;
       end return;
@@ -2141,12 +2163,48 @@ package body Ada.Containers.Vectors is
       Start     : Cursor)
       return Vector_Iterator_Interfaces.Reversible_Iterator'class
    is
-      B  : Natural renames Container'Unrestricted_Access.all.Busy;
+      V : constant Vector_Access := Container'Unrestricted_Access;
+      B : Natural renames V.Busy;
 
    begin
+      --  It was formerly the case that when Start = No_Element, the partial
+      --  iterator was defined to behave the same as for a complete iterator,
+      --  and iterate over the entire sequence of items. However, those
+      --  semantics were unintuitive and arguably error-prone (it is too easy
+      --  to accidentally create an endless loop), and so they were changed,
+      --  per the ARG meeting in Denver on 2011/11. However, there was no
+      --  consensus about what positive meaning this corner case should have,
+      --  and so it was decided to simply raise an exception. This does imply,
+      --  however, that it is not possible to use a partial iterator to specify
+      --  an empty sequence of items.
+
+      if Start.Container = null then
+         raise Constraint_Error with
+           "Start position for iterator equals No_Element";
+      end if;
+
+      if Start.Container /= V then
+         raise Program_Error with
+           "Start cursor of Iterate designates wrong vector";
+      end if;
+
+      if Start.Index > V.Last then
+         raise Constraint_Error with
+           "Start position for iterator equals No_Element";
+      end if;
+
+      --  The value of its Index component influences the behavior of the First
+      --  and Last selector functions of the iterator object. When the Index
+      --  component is not No_Index (as is the case here), it means that this
+      --  is a partial iteration, over a subset of the complete sequence of
+      --  items. The iterator object was constructed with a start expression,
+      --  indicating the position from which the iteration begins. Note that
+      --  the start position has the same value irrespective of whether this is
+      --  a forward or reverse iteration.
+
       return It : constant Iterator :=
                     (Limited_Controlled with
-                       Container => Container'Unrestricted_Access,
+                       Container => V,
                        Index     => Start.Index)
       do
          B := B + 1;
@@ -2168,10 +2226,23 @@ package body Ada.Containers.Vectors is
 
    function Last (Object : Iterator) return Cursor is
    begin
-      if Is_Empty (Object.Container.all) then
-         return No_Element;
+      --  The value of the iterator object's Index component influences the
+      --  behavior of the Last (and First) selector function.
+
+      --  When the Index component is No_Index, this means the iterator object
+      --  was constructed without a start expression, in which case the
+      --  (reverse) iteration starts from the (logical) beginning of the entire
+      --  sequence (corresponding to Container.Last, for a reverse iterator).
+
+      --  Otherwise, this is iteration over a partial sequence of items. When
+      --  the Index component is not No_Index, the iterator object was
+      --  constructed with a start expression, that specifies the position from
+      --  which the (reverse) partial iteration begins.
+
+      if Object.Index = No_Index then
+         return Last (Object.Container.all);
       else
-         return (Object.Container, Object.Container.Last);
+         return Cursor'(Object.Container, Object.Index);
       end if;
    end Last;
 
@@ -2282,11 +2353,16 @@ package body Ada.Containers.Vectors is
 
    function Next (Object : Iterator; Position : Cursor) return Cursor is
    begin
-      if Position.Index < Object.Container.Last then
-         return (Object.Container, Position.Index + 1);
-      else
+      if Position.Container = null then
          return No_Element;
       end if;
+
+      if Position.Container /= Object.Container then
+         raise Program_Error with
+           "Position cursor of Next designates wrong vector";
+      end if;
+
+      return Next (Position);
    end Next;
 
    procedure Next (Position : in out Cursor) is
@@ -2338,11 +2414,16 @@ package body Ada.Containers.Vectors is
 
    function Previous (Object : Iterator; Position : Cursor) return Cursor is
    begin
-      if Position.Index > Index_Type'First then
-         return (Object.Container, Position.Index - 1);
-      else
+      if Position.Container = null then
          return No_Element;
       end if;
+
+      if Position.Container /= Object.Container then
+         raise Program_Error with
+           "Position cursor of Previous designates wrong vector";
+      end if;
+
+      return Previous (Position);
    end Previous;
 
    procedure Previous (Position : in out Cursor) is
index 7763b1801de5893fb8bf6904a394cb3da49374e0..713053d6235e30948b06f4cd2f87f30112c14360 100644 (file)
@@ -6,7 +6,7 @@
  *                                                                          *
  *                              C Header File                               *
  *                                                                          *
- *         Copyright (C) 2004-2010, Free Software Foundation, Inc.          *
+ *         Copyright (C) 2004-2011, 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- *
 /* For Tru64 */
 #endif
 
-#include <limits.h>
-#include <errno.h>
+/** No system header may be included prior to this point since on some targets
+ ** we need to redefine FD_SETSIZE.
+ **/
+
+/* Target-specific includes and definitions */
 
 #if defined(__vxworks)
 #include <vxWorks.h>
 
 #elif defined(VMS)
 #define FD_SETSIZE 4096
+#include <sys/types.h>
+#include <sys/time.h>
 #ifndef IN_RTS
 /* These DEC C headers are not available when building with GCC */
 #include <in.h>
 
 #endif
 
+#include <limits.h>
+#include <errno.h>
+
 #if defined (__vxworks) && ! defined (__RTP__)
 #include <sys/times.h>
 #else
 #endif
 
 /*
- * RTEMS has these .h files but not until you have built and installed
- * RTEMS. When building a C/C++ toolset, you also build the newlib C library.
- * So the build procedure for an RTEMS GNAT toolset requires that
- * you build a C/C++ toolset, then build and install RTEMS with 
- * --enable-multilib, and finally build the Ada part of the toolset.
+ * RTEMS has these .h files but not until you have built and installed RTEMS.
+ * When building a C/C++ toolset, you also build the newlib C library, so the
+ * build procedure for an RTEMS GNAT toolset requires that you build a C/C++
+ * toolset, then build and install RTEMS with --enable-multilib, and finally
+ * build the Ada part of the toolset.
  */
 #if !(defined (VMS) || defined (__MINGW32__))
 #include <sys/socket.h>
index 10c57b474a39e75ac08109dec3b3cb4f20c7e814..ac64be4b837c56cc60e1f251654c36d202637ef8 100644 (file)
@@ -3,11 +3,10 @@
 --                         GNAT COMPILER COMPONENTS                         --
 --                                                                          --
 --                     M L I B . T G T. S P E C I F I C                     --
---                           (Bare Board Version)                           --
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2003-2008, Free Software Foundation, Inc.         --
+--          Copyright (C) 2003-2011, 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- --
@@ -139,33 +138,11 @@ package body MLib.Tgt.Specific is
 
    function Get_Target_Prefix return String is
       Target_Name : constant String_Ptr := Sdefault.Target_Name;
-      Index       : Positive            := Target_Name'First;
 
    begin
-      while Index < Target_Name'Last
-        and then Target_Name (Index + 1) /= '-'
-      loop
-         Index := Index + 1;
-      end loop;
-
-      if Target_Name (Target_Name'First .. Index) = "avr" then
-         return "avr-";
-      elsif Target_Name (Target_Name'First .. Index) = "erc32" then
-         return "erc32-elf-";
-      elsif Target_Name (Target_Name'First .. Index) = "leon" then
-         return "leon-elf-";
-      elsif Target_Name (Target_Name'First .. Index) = "powerpc" then
-         if Target_Name'Length >= 23 and then
-           Target_Name (Target_Name'First .. Target_Name'First + 22) =
-                                              "powerpc-unknown-eabispe"
-         then
-            return "powerpc-eabispe-";
-         else
-            return "powerpc-elf-";
-         end if;
-      else
-         return "";
-      end if;
+      --  Target_name is the program prefix without '-' but with a trailing '/'
+
+      return Target_Name (Target_Name'First .. Target_Name'Last - 1) & '-';
    end Get_Target_Prefix;
 
    --------------------------------------
index a8b40b737f8985413f4d314365b9a05d31eb9d5e..38991ce6be3640f29e0674816fdef6907d76c4d1 100644 (file)
@@ -1410,7 +1410,7 @@ package body Par_SCO is
                   Set_Statement_Entry;
 
                   --  Process case branches, all of which are dominated by the
-                  --  CASE expression.
+                  --  CASE statement.
 
                   declare
                      Alt : Node_Id;
@@ -1419,7 +1419,7 @@ package body Par_SCO is
                      while Present (Alt) loop
                         Traverse_Declarations_Or_Statements
                           (L => Statements (Alt),
-                           D => ('S', Expression (N)));
+                           D => Current_Dominant);
                         Next (Alt);
                      end loop;
                   end;
index e8a3b4dde9ce9fd74dd1e0a9a61dd3842e6bcf6c..143067c9926730d739d2ad41850f300e063964dc 100644 (file)
@@ -78,6 +78,8 @@ pragma Style_Checks ("M32766");
  **  $ RUN xoscons
  **/
 
+/* Feature macro definitions */
+
 #if defined (__linux__) && !defined (_XOPEN_SOURCE)
 /** For Linux _XOPEN_SOURCE must be defined, otherwise IOV_MAX is not defined
  **/
@@ -93,6 +95,10 @@ pragma Style_Checks ("M32766");
 #endif
 #endif
 
+/* Include gsocket.h before any system header so it can redefine FD_SETSIZE */
+
+#include "gsocket.h"
+
 #include <stdlib.h>
 #include <string.h>
 #include <limits.h>
@@ -130,8 +136,6 @@ pragma Style_Checks ("M32766");
 # include <vxWorks.h>
 #endif
 
-#include "gsocket.h"
-
 #ifdef DUMMY
 
 # if defined (TARGET)
index 7de3c164ede44696ca37bcdcfab905ed5b2c7b76..1c607d97cd7081d8a52dd516897c4a612c2da1a5 100644 (file)
@@ -5872,7 +5872,20 @@ package body Sem_Ch13 is
       --  All other cases
 
       else
-         Preanalyze_Spec_Expression (End_Decl_Expr, T);
+         --  In a generic context freeze nodes are not generated, and the
+         --  aspect expressions have not been preanalyzed, so do it now.
+         --  There are no conformance checks to perform in this case.
+
+         if No (T)
+           and then Inside_A_Generic
+         then
+            Check_Aspect_At_Freeze_Point (ASN);
+            return;
+
+         else
+            Preanalyze_Spec_Expression (End_Decl_Expr, T);
+         end if;
+
          Err := not Fully_Conformant_Expressions (End_Decl_Expr, Freeze_Expr);
       end if;