Commit e8bd500e by Arnaud Charlet

[multiple changes]

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
parent 7520518f
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> 2011-12-12 Robert Dewar <dewar@adacore.com>
* par_sco.adb, scos.ads, put_scos.adb, get_scos.adb: Minor reformatting. * par_sco.adb, scos.ads, put_scos.adb, get_scos.adb: Minor reformatting.
......
...@@ -935,7 +935,7 @@ package body Ada.Containers.Bounded_Ordered_Maps is ...@@ -935,7 +935,7 @@ package body Ada.Containers.Bounded_Ordered_Maps is
return It : constant Iterator := return It : constant Iterator :=
(Limited_Controlled with (Limited_Controlled with
Container => Container'Unrestricted_Access, Container => Container'Unrestricted_Access,
Node => Container.First) Node => 0)
do do
B := B + 1; B := B + 1;
end return; end return;
......
...@@ -38,7 +38,7 @@ package body Ada.Containers.Bounded_Vectors is ...@@ -38,7 +38,7 @@ package body Ada.Containers.Bounded_Vectors is
Vector_Iterator_Interfaces.Reversible_Iterator with Vector_Iterator_Interfaces.Reversible_Iterator with
record record
Container : Vector_Access; Container : Vector_Access;
Index : Index_Type; Index : Index_Type'Base;
end record; end record;
overriding procedure Finalize (Object : in out Iterator); overriding procedure Finalize (Object : in out Iterator);
...@@ -667,14 +667,9 @@ package body Ada.Containers.Bounded_Vectors is ...@@ -667,14 +667,9 @@ package body Ada.Containers.Bounded_Vectors is
-------------- --------------
procedure Finalize (Object : in out Iterator) is procedure Finalize (Object : in out Iterator) is
B : Natural renames Object.Container.Busy;
begin begin
if Object.Container /= null then B := B - 1;
declare
B : Natural renames Object.Container.all.Busy;
begin
B := B - 1;
end;
end if;
end Finalize; end Finalize;
---------- ----------
...@@ -740,10 +735,24 @@ package body Ada.Containers.Bounded_Vectors is ...@@ -740,10 +735,24 @@ package body Ada.Containers.Bounded_Vectors is
function First (Object : Iterator) return Cursor is function First (Object : Iterator) return Cursor is
begin begin
if Is_Empty (Object.Container.all) then -- The value of the iterator object's Index component influences the
return No_Element; -- 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 else
return Cursor'(Object.Container, Index_Type'First); return Cursor'(Object.Container, Object.Index);
end if; end if;
end First; end First;
...@@ -1648,12 +1657,24 @@ package body Ada.Containers.Bounded_Vectors is ...@@ -1648,12 +1657,24 @@ package body Ada.Containers.Bounded_Vectors is
(Container : Vector) (Container : Vector)
return Vector_Iterator_Interfaces.Reversible_Iterator'Class return Vector_Iterator_Interfaces.Reversible_Iterator'Class
is is
B : Natural renames Container'Unrestricted_Access.all.Busy; V : constant Vector_Access := Container'Unrestricted_Access;
B : Natural renames V.Busy;
begin 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 := return It : constant Iterator :=
Iterator'(Limited_Controlled with (Limited_Controlled with
Container => Container'Unrestricted_Access, Container => V,
Index => Index_Type'First) Index => No_Index)
do do
B := B + 1; B := B + 1;
end return; end return;
...@@ -1662,14 +1683,51 @@ package body Ada.Containers.Bounded_Vectors is ...@@ -1662,14 +1683,51 @@ package body Ada.Containers.Bounded_Vectors is
function Iterate function Iterate
(Container : Vector; (Container : Vector;
Start : Cursor) Start : Cursor)
return Vector_Iterator_Interfaces.Reversible_Iterator'class return Vector_Iterator_Interfaces.Reversible_Iterator'Class
is is
B : Natural renames Container'Unrestricted_Access.all.Busy; V : constant Vector_Access := Container'Unrestricted_Access;
B : Natural renames V.Busy;
begin 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 := return It : constant Iterator :=
Iterator'(Limited_Controlled with (Limited_Controlled with
Container => Container'Unrestricted_Access, Container => V,
Index => Start.Index) Index => Start.Index)
do do
B := B + 1; B := B + 1;
end return; end return;
...@@ -1690,10 +1748,23 @@ package body Ada.Containers.Bounded_Vectors is ...@@ -1690,10 +1748,23 @@ package body Ada.Containers.Bounded_Vectors is
function Last (Object : Iterator) return Cursor is function Last (Object : Iterator) return Cursor is
begin begin
if Is_Empty (Object.Container.all) then -- The value of the iterator object's Index component influences the
return No_Element; -- 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 else
return Cursor'(Object.Container, Object.Container.Last); return Cursor'(Object.Container, Object.Index);
end if; end if;
end Last; end Last;
...@@ -1811,11 +1882,16 @@ package body Ada.Containers.Bounded_Vectors is ...@@ -1811,11 +1882,16 @@ package body Ada.Containers.Bounded_Vectors is
function Next (Object : Iterator; Position : Cursor) return Cursor is function Next (Object : Iterator; Position : Cursor) return Cursor is
begin begin
if Position.Index = Object.Container.Last then if Position.Container = null then
return No_Element; return No_Element;
else end if;
return (Object.Container, Position.Index + 1);
if Position.Container /= Object.Container then
raise Program_Error with
"Position cursor of Next designates wrong vector";
end if; end if;
return Next (Position);
end Next; end Next;
procedure Next (Position : in out Cursor) is procedure Next (Position : in out Cursor) is
...@@ -1884,11 +1960,16 @@ package body Ada.Containers.Bounded_Vectors is ...@@ -1884,11 +1960,16 @@ package body Ada.Containers.Bounded_Vectors is
function Previous (Object : Iterator; Position : Cursor) return Cursor is function Previous (Object : Iterator; Position : Cursor) return Cursor is
begin begin
if Position.Index > Index_Type'First then if Position.Container = null then
return (Object.Container, Position.Index - 1);
else
return No_Element; return No_Element;
end if; 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; end Previous;
------------------- -------------------
......
...@@ -44,7 +44,7 @@ package body Ada.Containers.Indefinite_Vectors is ...@@ -44,7 +44,7 @@ package body Ada.Containers.Indefinite_Vectors is
Vector_Iterator_Interfaces.Reversible_Iterator with Vector_Iterator_Interfaces.Reversible_Iterator with
record record
Container : Vector_Access; Container : Vector_Access;
Index : Index_Type; Index : Index_Type'Base;
end record; end record;
overriding procedure Finalize (Object : in out Iterator); overriding procedure Finalize (Object : in out Iterator);
...@@ -1109,14 +1109,9 @@ package body Ada.Containers.Indefinite_Vectors is ...@@ -1109,14 +1109,9 @@ package body Ada.Containers.Indefinite_Vectors is
end Finalize; end Finalize;
procedure Finalize (Object : in out Iterator) is procedure Finalize (Object : in out Iterator) is
B : Natural renames Object.Container.Busy;
begin begin
if Object.Container /= null then B := B - 1;
declare
B : Natural renames Object.Container.all.Busy;
begin
B := B - 1;
end;
end if;
end Finalize; end Finalize;
---------- ----------
...@@ -1185,9 +1180,26 @@ package body Ada.Containers.Indefinite_Vectors is ...@@ -1185,9 +1180,26 @@ package body Ada.Containers.Indefinite_Vectors is
end First; end First;
function First (Object : Iterator) return Cursor is function First (Object : Iterator) return Cursor is
C : constant Cursor := (Object.Container, Index_Type'First);
begin 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; end First;
------------------- -------------------
...@@ -2552,15 +2564,26 @@ package body Ada.Containers.Indefinite_Vectors is ...@@ -2552,15 +2564,26 @@ package body Ada.Containers.Indefinite_Vectors is
end Iterate; end Iterate;
function Iterate (Container : Vector) function Iterate (Container : Vector)
return Vector_Iterator_Interfaces.Reversible_Iterator'class return Vector_Iterator_Interfaces.Reversible_Iterator'Class
is is
B : Natural renames Container'Unrestricted_Access.all.Busy; V : constant Vector_Access := Container'Unrestricted_Access;
B : Natural renames V.Busy;
begin 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 := return It : constant Iterator :=
(Limited_Controlled with (Limited_Controlled with
Container => Container'Unrestricted_Access, Container => V,
Index => Index_Type'First) Index => No_Index)
do do
B := B + 1; B := B + 1;
end return; end return;
...@@ -2569,14 +2592,50 @@ package body Ada.Containers.Indefinite_Vectors is ...@@ -2569,14 +2592,50 @@ package body Ada.Containers.Indefinite_Vectors is
function Iterate function Iterate
(Container : Vector; (Container : Vector;
Start : Cursor) Start : Cursor)
return Vector_Iterator_Interfaces.Reversible_Iterator'class return Vector_Iterator_Interfaces.Reversible_Iterator'Class
is is
B : Natural renames Container'Unrestricted_Access.all.Busy; V : constant Vector_Access := Container'Unrestricted_Access;
B : Natural renames V.Busy;
begin 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 := return It : constant Iterator :=
(Limited_Controlled with (Limited_Controlled with
Container => Container'Unrestricted_Access, Container => V,
Index => Start.Index) Index => Start.Index)
do do
B := B + 1; B := B + 1;
...@@ -2597,9 +2656,25 @@ package body Ada.Containers.Indefinite_Vectors is ...@@ -2597,9 +2656,25 @@ package body Ada.Containers.Indefinite_Vectors is
end Last; end Last;
function Last (Object : Iterator) return Cursor is function Last (Object : Iterator) return Cursor is
C : constant Cursor := (Object.Container, Object.Container.Last);
begin 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; end Last;
----------------- -----------------
...@@ -2718,11 +2793,16 @@ package body Ada.Containers.Indefinite_Vectors is ...@@ -2718,11 +2793,16 @@ package body Ada.Containers.Indefinite_Vectors is
function Next (Object : Iterator; Position : Cursor) return Cursor is function Next (Object : Iterator; Position : Cursor) return Cursor is
begin begin
if Position.Index = Object.Container.Last then if Position.Container = null then
return No_Element; return No_Element;
else
return (Object.Container, Position.Index + 1);
end if; 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; end Next;
procedure Next (Position : in out Cursor) is procedure Next (Position : in out Cursor) is
...@@ -2791,11 +2871,16 @@ package body Ada.Containers.Indefinite_Vectors is ...@@ -2791,11 +2871,16 @@ package body Ada.Containers.Indefinite_Vectors is
function Previous (Object : Iterator; Position : Cursor) return Cursor is function Previous (Object : Iterator; Position : Cursor) return Cursor is
begin begin
if Position.Index > Index_Type'First then if Position.Container = null then
return (Object.Container, Position.Index - 1);
else
return No_Element; return No_Element;
end if; 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; end Previous;
------------------- -------------------
......
...@@ -41,16 +41,18 @@ package body Ada.Containers.Vectors is ...@@ -41,16 +41,18 @@ package body Ada.Containers.Vectors is
Vector_Iterator_Interfaces.Reversible_Iterator with Vector_Iterator_Interfaces.Reversible_Iterator with
record record
Container : Vector_Access; Container : Vector_Access;
Index : Index_Type; Index : Index_Type'Base;
end record; end record;
overriding procedure Finalize (Object : in out Iterator); overriding procedure Finalize (Object : in out Iterator);
overriding function First (Object : Iterator) return Cursor; overriding function First (Object : Iterator) return Cursor;
overriding function Last (Object : Iterator) return Cursor; overriding function Last (Object : Iterator) return Cursor;
overriding function Next overriding function Next
(Object : Iterator; (Object : Iterator;
Position : Cursor) return Cursor; Position : Cursor) return Cursor;
overriding function Previous overriding function Previous
(Object : Iterator; (Object : Iterator;
Position : Cursor) return Cursor; Position : Cursor) return Cursor;
...@@ -782,14 +784,9 @@ package body Ada.Containers.Vectors is ...@@ -782,14 +784,9 @@ package body Ada.Containers.Vectors is
end Finalize; end Finalize;
procedure Finalize (Object : in out Iterator) is procedure Finalize (Object : in out Iterator) is
B : Natural renames Object.Container.Busy;
begin begin
if Object.Container /= null then B := B - 1;
declare
B : Natural renames Object.Container.all.Busy;
begin
B := B - 1;
end;
end if;
end Finalize; end Finalize;
---------- ----------
...@@ -855,10 +852,24 @@ package body Ada.Containers.Vectors is ...@@ -855,10 +852,24 @@ package body Ada.Containers.Vectors is
function First (Object : Iterator) return Cursor is function First (Object : Iterator) return Cursor is
begin begin
if Is_Empty (Object.Container.all) then -- The value of the iterator object's Index component influences the
return No_Element; -- 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 else
return (Object.Container, Index_Type'First); return Cursor'(Object.Container, Object.Index);
end if; end if;
end First; end First;
...@@ -2124,13 +2135,24 @@ package body Ada.Containers.Vectors is ...@@ -2124,13 +2135,24 @@ package body Ada.Containers.Vectors is
(Container : Vector) (Container : Vector)
return Vector_Iterator_Interfaces.Reversible_Iterator'Class return Vector_Iterator_Interfaces.Reversible_Iterator'Class
is is
B : Natural renames Container'Unrestricted_Access.all.Busy; V : constant Vector_Access := Container'Unrestricted_Access;
B : Natural renames V.Busy;
begin 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 := return It : constant Iterator :=
(Limited_Controlled with (Limited_Controlled with
Container => Container'Unrestricted_Access, Container => V,
Index => Index_Type'First) Index => No_Index)
do do
B := B + 1; B := B + 1;
end return; end return;
...@@ -2141,12 +2163,48 @@ package body Ada.Containers.Vectors is ...@@ -2141,12 +2163,48 @@ package body Ada.Containers.Vectors is
Start : Cursor) Start : Cursor)
return Vector_Iterator_Interfaces.Reversible_Iterator'class return Vector_Iterator_Interfaces.Reversible_Iterator'class
is is
B : Natural renames Container'Unrestricted_Access.all.Busy; V : constant Vector_Access := Container'Unrestricted_Access;
B : Natural renames V.Busy;
begin 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 := return It : constant Iterator :=
(Limited_Controlled with (Limited_Controlled with
Container => Container'Unrestricted_Access, Container => V,
Index => Start.Index) Index => Start.Index)
do do
B := B + 1; B := B + 1;
...@@ -2168,10 +2226,23 @@ package body Ada.Containers.Vectors is ...@@ -2168,10 +2226,23 @@ package body Ada.Containers.Vectors is
function Last (Object : Iterator) return Cursor is function Last (Object : Iterator) return Cursor is
begin begin
if Is_Empty (Object.Container.all) then -- The value of the iterator object's Index component influences the
return No_Element; -- 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 else
return (Object.Container, Object.Container.Last); return Cursor'(Object.Container, Object.Index);
end if; end if;
end Last; end Last;
...@@ -2282,11 +2353,16 @@ package body Ada.Containers.Vectors is ...@@ -2282,11 +2353,16 @@ package body Ada.Containers.Vectors is
function Next (Object : Iterator; Position : Cursor) return Cursor is function Next (Object : Iterator; Position : Cursor) return Cursor is
begin begin
if Position.Index < Object.Container.Last then if Position.Container = null then
return (Object.Container, Position.Index + 1);
else
return No_Element; return No_Element;
end if; 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; end Next;
procedure Next (Position : in out Cursor) is procedure Next (Position : in out Cursor) is
...@@ -2338,11 +2414,16 @@ package body Ada.Containers.Vectors is ...@@ -2338,11 +2414,16 @@ package body Ada.Containers.Vectors is
function Previous (Object : Iterator; Position : Cursor) return Cursor is function Previous (Object : Iterator; Position : Cursor) return Cursor is
begin begin
if Position.Index > Index_Type'First then if Position.Container = null then
return (Object.Container, Position.Index - 1);
else
return No_Element; return No_Element;
end if; 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; end Previous;
procedure Previous (Position : in out Cursor) is procedure Previous (Position : in out Cursor) is
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* * * *
* C Header File * * 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 * * 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- * * terms of the GNU General Public License as published by the Free Soft- *
...@@ -58,8 +58,11 @@ ...@@ -58,8 +58,11 @@
/* For Tru64 */ /* For Tru64 */
#endif #endif
#include <limits.h> /** No system header may be included prior to this point since on some targets
#include <errno.h> ** we need to redefine FD_SETSIZE.
**/
/* Target-specific includes and definitions */
#if defined(__vxworks) #if defined(__vxworks)
#include <vxWorks.h> #include <vxWorks.h>
...@@ -163,6 +166,8 @@ ...@@ -163,6 +166,8 @@
#elif defined(VMS) #elif defined(VMS)
#define FD_SETSIZE 4096 #define FD_SETSIZE 4096
#include <sys/types.h>
#include <sys/time.h>
#ifndef IN_RTS #ifndef IN_RTS
/* These DEC C headers are not available when building with GCC */ /* These DEC C headers are not available when building with GCC */
#include <in.h> #include <in.h>
...@@ -173,6 +178,9 @@ ...@@ -173,6 +178,9 @@
#endif #endif
#include <limits.h>
#include <errno.h>
#if defined (__vxworks) && ! defined (__RTP__) #if defined (__vxworks) && ! defined (__RTP__)
#include <sys/times.h> #include <sys/times.h>
#else #else
...@@ -180,11 +188,11 @@ ...@@ -180,11 +188,11 @@
#endif #endif
/* /*
* RTEMS has these .h files but not until you have built and installed * RTEMS has these .h files but not until you have built and installed RTEMS.
* RTEMS. When building a C/C++ toolset, you also build the newlib C library. * When building a C/C++ toolset, you also build the newlib C library, so the
* So the build procedure for an RTEMS GNAT toolset requires that * build procedure for an RTEMS GNAT toolset requires that you build a C/C++
* you build a C/C++ toolset, then build and install RTEMS with * toolset, then build and install RTEMS with --enable-multilib, and finally
* --enable-multilib, and finally build the Ada part of the toolset. * build the Ada part of the toolset.
*/ */
#if !(defined (VMS) || defined (__MINGW32__)) #if !(defined (VMS) || defined (__MINGW32__))
#include <sys/socket.h> #include <sys/socket.h>
......
...@@ -3,11 +3,10 @@ ...@@ -3,11 +3,10 @@
-- GNAT COMPILER COMPONENTS -- -- GNAT COMPILER COMPONENTS --
-- -- -- --
-- M L I B . T G T. S P E C I F I C -- -- M L I B . T G T. S P E C I F I C --
-- (Bare Board Version) --
-- -- -- --
-- B o d y -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -139,33 +138,11 @@ package body MLib.Tgt.Specific is ...@@ -139,33 +138,11 @@ package body MLib.Tgt.Specific is
function Get_Target_Prefix return String is function Get_Target_Prefix return String is
Target_Name : constant String_Ptr := Sdefault.Target_Name; Target_Name : constant String_Ptr := Sdefault.Target_Name;
Index : Positive := Target_Name'First;
begin begin
while Index < Target_Name'Last -- Target_name is the program prefix without '-' but with a trailing '/'
and then Target_Name (Index + 1) /= '-'
loop return Target_Name (Target_Name'First .. Target_Name'Last - 1) & '-';
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;
end Get_Target_Prefix; end Get_Target_Prefix;
-------------------------------------- --------------------------------------
......
...@@ -1410,7 +1410,7 @@ package body Par_SCO is ...@@ -1410,7 +1410,7 @@ package body Par_SCO is
Set_Statement_Entry; Set_Statement_Entry;
-- Process case branches, all of which are dominated by the -- Process case branches, all of which are dominated by the
-- CASE expression. -- CASE statement.
declare declare
Alt : Node_Id; Alt : Node_Id;
...@@ -1419,7 +1419,7 @@ package body Par_SCO is ...@@ -1419,7 +1419,7 @@ package body Par_SCO is
while Present (Alt) loop while Present (Alt) loop
Traverse_Declarations_Or_Statements Traverse_Declarations_Or_Statements
(L => Statements (Alt), (L => Statements (Alt),
D => ('S', Expression (N))); D => Current_Dominant);
Next (Alt); Next (Alt);
end loop; end loop;
end; end;
......
...@@ -78,6 +78,8 @@ pragma Style_Checks ("M32766"); ...@@ -78,6 +78,8 @@ pragma Style_Checks ("M32766");
** $ RUN xoscons ** $ RUN xoscons
**/ **/
/* Feature macro definitions */
#if defined (__linux__) && !defined (_XOPEN_SOURCE) #if defined (__linux__) && !defined (_XOPEN_SOURCE)
/** For Linux _XOPEN_SOURCE must be defined, otherwise IOV_MAX is not defined /** For Linux _XOPEN_SOURCE must be defined, otherwise IOV_MAX is not defined
**/ **/
...@@ -93,6 +95,10 @@ pragma Style_Checks ("M32766"); ...@@ -93,6 +95,10 @@ pragma Style_Checks ("M32766");
#endif #endif
#endif #endif
/* Include gsocket.h before any system header so it can redefine FD_SETSIZE */
#include "gsocket.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
...@@ -130,8 +136,6 @@ pragma Style_Checks ("M32766"); ...@@ -130,8 +136,6 @@ pragma Style_Checks ("M32766");
# include <vxWorks.h> # include <vxWorks.h>
#endif #endif
#include "gsocket.h"
#ifdef DUMMY #ifdef DUMMY
# if defined (TARGET) # if defined (TARGET)
......
...@@ -5872,7 +5872,20 @@ package body Sem_Ch13 is ...@@ -5872,7 +5872,20 @@ package body Sem_Ch13 is
-- All other cases -- All other cases
else 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); Err := not Fully_Conformant_Expressions (End_Decl_Expr, Freeze_Expr);
end if; end if;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment