Commit 690943fc by Robert Dewar Committed by Arnaud Charlet

a-cdlili.adb, [...]: Minor reformatting.

2011-08-29  Robert Dewar  <dewar@adacore.com>

	* a-cdlili.adb, a-cdlili.ads, a-coinve.adb, a-coinve.ads,
	sem_util.adb, sem_util.ads, a-cohama.adb, a-cohama.ads, a-coorse.adb,
	a-coorse.ads, aspects.ads, sem_ch8.adb: Minor reformatting.

From-SVN: r178232
parent ff15f019
2011-08-29 Robert Dewar <dewar@adacore.com>
* a-cdlili.adb, a-cdlili.ads, a-coinve.adb, a-coinve.ads,
sem_util.adb, sem_util.ads, a-cohama.adb, a-cohama.ads, a-coorse.adb,
a-coorse.ads, aspects.ads, sem_ch8.adb: Minor reformatting.
2011-08-29 Thomas Quinot <quinot@adacore.com> 2011-08-29 Thomas Quinot <quinot@adacore.com>
* system-freebsd-x86_64.ads (Backend_Overflow_Checks): Set true True. * system-freebsd-x86_64.ads (Backend_Overflow_Checks): Set true True.
......
...@@ -38,12 +38,16 @@ package body Ada.Containers.Doubly_Linked_Lists is ...@@ -38,12 +38,16 @@ package body Ada.Containers.Doubly_Linked_Lists is
Node : Node_Access; Node : Node_Access;
end record; end record;
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 (Object : Iterator; Position : Cursor)
return Cursor; overriding function Next
overriding function Previous (Object : Iterator; Position : Cursor) (Object : Iterator;
return Cursor; Position : Cursor) return Cursor;
overriding function Previous
(Object : Iterator;
Position : Cursor) return Cursor;
----------------------- -----------------------
-- Local Subprograms -- -- Local Subprograms --
...@@ -918,6 +922,7 @@ package body Ada.Containers.Doubly_Linked_Lists is ...@@ -918,6 +922,7 @@ package body Ada.Containers.Doubly_Linked_Lists is
declare declare
Next_Node : constant Node_Access := Position.Node.Next; Next_Node : constant Node_Access := Position.Node.Next;
begin begin
if Next_Node = null then if Next_Node = null then
return No_Element; return No_Element;
...@@ -927,11 +932,13 @@ package body Ada.Containers.Doubly_Linked_Lists is ...@@ -927,11 +932,13 @@ package body Ada.Containers.Doubly_Linked_Lists is
end; end;
end Next; end Next;
function Next (Object : Iterator; Position : Cursor) return Cursor is function Next
(Object : Iterator;
Position : Cursor) return Cursor
is
begin begin
if Position.Node = Object.Container.Last then if Position.Node = Object.Container.Last then
return No_Element; return No_Element;
else else
return (Object.Container, Position.Node.Next); return (Object.Container, Position.Node.Next);
end if; end if;
...@@ -969,6 +976,7 @@ package body Ada.Containers.Doubly_Linked_Lists is ...@@ -969,6 +976,7 @@ package body Ada.Containers.Doubly_Linked_Lists is
declare declare
Prev_Node : constant Node_Access := Position.Node.Prev; Prev_Node : constant Node_Access := Position.Node.Prev;
begin begin
if Prev_Node = null then if Prev_Node = null then
return No_Element; return No_Element;
...@@ -978,11 +986,13 @@ package body Ada.Containers.Doubly_Linked_Lists is ...@@ -978,11 +986,13 @@ package body Ada.Containers.Doubly_Linked_Lists is
end; end;
end Previous; end Previous;
function Previous (Object : Iterator; Position : Cursor) return Cursor is function Previous
(Object : Iterator;
Position : Cursor) return Cursor
is
begin begin
if Position.Node = Position.Container.First then if Position.Node = Position.Container.First then
return No_Element; return No_Element;
else else
return (Object.Container, Position.Node.Prev); return (Object.Container, Position.Node.Prev);
end if; end if;
......
...@@ -32,7 +32,8 @@ ...@@ -32,7 +32,8 @@
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
private with Ada.Finalization; private with Ada.Finalization;
with Ada.Streams; use Ada.Streams;
with Ada.Streams; use Ada.Streams;
with Ada.Iterator_Interfaces; with Ada.Iterator_Interfaces;
generic generic
......
...@@ -39,13 +39,15 @@ package body Ada.Containers.Hashed_Maps is ...@@ -39,13 +39,15 @@ package body Ada.Containers.Hashed_Maps is
type Iterator is new type Iterator is new
Map_Iterator_Interfaces.Forward_Iterator with record Map_Iterator_Interfaces.Forward_Iterator with record
Container : Map_Access; Container : Map_Access;
Node : Node_Access; Node : Node_Access;
end record; end record;
overriding function First (Object : Iterator) return Cursor; overriding function First (Object : Iterator) return Cursor;
overriding function Next (Object : Iterator; Position : Cursor)
return Cursor; overriding function Next
(Object : Iterator;
Position : Cursor) return Cursor;
----------------------- -----------------------
-- Local Subprograms -- -- Local Subprograms --
...@@ -599,8 +601,8 @@ package body Ada.Containers.Hashed_Maps is ...@@ -599,8 +601,8 @@ package body Ada.Containers.Hashed_Maps is
B := B - 1; B := B - 1;
end Iterate; end Iterate;
function Iterate (Container : Map) function Iterate
return Map_Iterator_Interfaces.Forward_Iterator'class (Container : Map) return Map_Iterator_Interfaces.Forward_Iterator'class
is is
Node : constant Node_Access := HT_Ops.First (Container.HT); Node : constant Node_Access := HT_Ops.First (Container.HT);
It : constant Iterator := (Container'Unrestricted_Access, Node); It : constant Iterator := (Container'Unrestricted_Access, Node);
...@@ -680,11 +682,13 @@ package body Ada.Containers.Hashed_Maps is ...@@ -680,11 +682,13 @@ package body Ada.Containers.Hashed_Maps is
Position := Next (Position); Position := Next (Position);
end Next; end Next;
function Next (Object : Iterator; Position : Cursor) return Cursor is function Next
(Object : Iterator;
Position : Cursor) return Cursor
is
begin begin
if Position.Node = null then if Position.Node = null then
return No_Element; return No_Element;
else else
return (Object.Container, Next (Position).Node); return (Object.Container, Next (Position).Node);
end if; end if;
......
...@@ -32,8 +32,9 @@ ...@@ -32,8 +32,9 @@
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
private with Ada.Containers.Hash_Tables; private with Ada.Containers.Hash_Tables;
with Ada.Streams; use Ada.Streams;
private with Ada.Finalization; private with Ada.Finalization;
with Ada.Streams; use Ada.Streams;
with Ada.Iterator_Interfaces; with Ada.Iterator_Interfaces;
generic generic
......
...@@ -46,11 +46,16 @@ package body Ada.Containers.Indefinite_Vectors is ...@@ -46,11 +46,16 @@ package body Ada.Containers.Indefinite_Vectors is
end record; end record;
overriding function First (Object : Iterator) return Cursor; overriding function First (Object : Iterator) return Cursor;
overriding function Last (Object : Iterator) return Cursor;
overriding function Next (Object : Iterator; Position : Cursor) overriding function Last (Object : Iterator) return Cursor;
return Cursor;
overriding function Previous (Object : Iterator; Position : Cursor) overriding function Next
return Cursor; (Object : Iterator;
Position : Cursor) return Cursor;
overriding function Previous
(Object : Iterator;
Position : Cursor) return Cursor;
--------- ---------
-- "&" -- -- "&" --
...@@ -2433,7 +2438,9 @@ package body Ada.Containers.Indefinite_Vectors is ...@@ -2433,7 +2438,9 @@ package body Ada.Containers.Indefinite_Vectors is
return It; return It;
end Iterate; end Iterate;
function Iterate (Container : Vector; Start : Cursor) function Iterate
(Container : Vector;
Start : Cursor)
return Vector_Iterator_Interfaces.Reversible_Iterator'class return Vector_Iterator_Interfaces.Reversible_Iterator'class
is is
It : constant Iterator := It : constant Iterator :=
...@@ -2584,10 +2591,6 @@ package body Ada.Containers.Indefinite_Vectors is ...@@ -2584,10 +2591,6 @@ package body Ada.Containers.Indefinite_Vectors is
end if; end if;
end Next; end Next;
----------
-- Next --
----------
procedure Next (Position : in out Cursor) is procedure Next (Position : in out Cursor) is
begin begin
if Position.Container = null then if Position.Container = null then
......
...@@ -32,7 +32,8 @@ ...@@ -32,7 +32,8 @@
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
private with Ada.Finalization; private with Ada.Finalization;
with Ada.Streams; use Ada.Streams;
with Ada.Streams; use Ada.Streams;
with Ada.Iterator_Interfaces; with Ada.Iterator_Interfaces;
generic generic
...@@ -344,7 +345,9 @@ package Ada.Containers.Indefinite_Vectors is ...@@ -344,7 +345,9 @@ package Ada.Containers.Indefinite_Vectors is
function Iterate (Container : Vector) function Iterate (Container : Vector)
return Vector_Iterator_Interfaces.Reversible_Iterator'class; return Vector_Iterator_Interfaces.Reversible_Iterator'class;
function Iterate (Container : Vector; Start : Cursor) function Iterate
(Container : Vector;
Start : Cursor)
return Vector_Iterator_Interfaces.Reversible_Iterator'class; return Vector_Iterator_Interfaces.Reversible_Iterator'class;
procedure Reverse_Iterate procedure Reverse_Iterate
...@@ -398,10 +401,10 @@ private ...@@ -398,10 +401,10 @@ private
end record; end record;
type Constant_Reference_Type type Constant_Reference_Type
(Element : not null access constant Element_Type) is null record; (Element : not null access constant Element_Type) is null record;
type Reference_Type type Reference_Type
(Element : not null access Element_Type) is null record; (Element : not null access Element_Type) is null record;
overriding procedure Adjust (Container : in out Vector); overriding procedure Adjust (Container : in out Vector);
......
...@@ -42,16 +42,21 @@ package body Ada.Containers.Ordered_Sets is ...@@ -42,16 +42,21 @@ package body Ada.Containers.Ordered_Sets is
type Iterator is new type Iterator is new
Ordered_Set_Iterator_Interfaces.Reversible_Iterator with record Ordered_Set_Iterator_Interfaces.Reversible_Iterator with record
Container : access constant Set; Container : access constant Set;
Node : Node_Access; Node : Node_Access;
end record; end record;
overriding function First (Object : Iterator) return Cursor; overriding function First (Object : Iterator) return Cursor;
overriding function Last (Object : Iterator) return Cursor;
overriding function Next (Object : Iterator; Position : Cursor) overriding function Last (Object : Iterator) return Cursor;
return Cursor;
overriding function Previous (Object : Iterator; Position : Cursor) overriding function Next
return Cursor; (Object : Iterator;
Position : Cursor) return Cursor;
overriding function Previous
(Object : Iterator;
Position : Cursor) return Cursor;
------------------------------ ------------------------------
-- Access to Fields of Node -- -- Access to Fields of Node --
...@@ -1248,9 +1253,7 @@ package body Ada.Containers.Ordered_Sets is ...@@ -1248,9 +1253,7 @@ package body Ada.Containers.Ordered_Sets is
Position := Next (Position); Position := Next (Position);
end Next; end Next;
function Next (Object : Iterator; Position : Cursor) function Next (Object : Iterator; Position : Cursor) return Cursor is
return Cursor
is
pragma Unreferenced (Object); pragma Unreferenced (Object);
begin begin
return Next (Position); return Next (Position);
...@@ -1305,13 +1308,12 @@ package body Ada.Containers.Ordered_Sets is ...@@ -1305,13 +1308,12 @@ package body Ada.Containers.Ordered_Sets is
Position := Previous (Position); Position := Previous (Position);
end Previous; end Previous;
overriding function Previous (Object : Iterator; Position : Cursor) function Previous (Object : Iterator; Position : Cursor) return Cursor is
return Cursor
is
pragma Unreferenced (Object); pragma Unreferenced (Object);
begin begin
return Previous (Position); return Previous (Position);
end Previous; end Previous;
------------------- -------------------
-- Query_Element -- -- Query_Element --
------------------- -------------------
......
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
private with Ada.Containers.Red_Black_Trees; private with Ada.Containers.Red_Black_Trees;
private with Ada.Finalization; private with Ada.Finalization;
with Ada.Streams; use Ada.Streams;
with Ada.Streams; use Ada.Streams;
with Ada.Iterator_Interfaces; with Ada.Iterator_Interfaces;
generic generic
...@@ -254,10 +255,13 @@ package Ada.Containers.Ordered_Sets is ...@@ -254,10 +255,13 @@ package Ada.Containers.Ordered_Sets is
(Container : Set; (Container : Set;
Process : not null access procedure (Position : Cursor)); Process : not null access procedure (Position : Cursor));
function Iterate (Container : Set) function Iterate
(Container : Set)
return Ordered_Set_Iterator_Interfaces.Reversible_Iterator'class; return Ordered_Set_Iterator_Interfaces.Reversible_Iterator'class;
function Iterate (Container : Set; Start : Cursor) function Iterate
(Container : Set;
Start : Cursor)
return Ordered_Set_Iterator_Interfaces.Reversible_Iterator'class; return Ordered_Set_Iterator_Interfaces.Reversible_Iterator'class;
generic generic
......
...@@ -360,7 +360,7 @@ package Aspects is ...@@ -360,7 +360,7 @@ package Aspects is
-- empty list or No_List. -- empty list or No_List.
function Find_Aspect (Ent : Entity_Id; A : Aspect_Id) return Node_Id; function Find_Aspect (Ent : Entity_Id; A : Aspect_Id) return Node_Id;
-- Find value of a given aspect from aspect list of entity. -- Find value of a given aspect from aspect list of entity
procedure Move_Aspects (From : Node_Id; To : Node_Id); procedure Move_Aspects (From : Node_Id; To : Node_Id);
-- Moves aspects from 'From' node to 'To' node. Has_Aspects (To) must be -- Moves aspects from 'From' node to 'To' node. Has_Aspects (To) must be
......
...@@ -5141,7 +5141,7 @@ package body Sem_Ch8 is ...@@ -5141,7 +5141,7 @@ package body Sem_Ch8 is
Next_Entity (Id); Next_Entity (Id);
end loop; end loop;
-- If not found, standard error message -- If not found, standard error message
Error_Msg_NE ("& not declared in&", N, Selector); Error_Msg_NE ("& not declared in&", N, Selector);
......
...@@ -990,17 +990,14 @@ package body Sem_Util is ...@@ -990,17 +990,14 @@ package body Sem_Util is
Disc : Entity_Id) Disc : Entity_Id)
is is
Loc : constant Source_Ptr := Sloc (Expr); Loc : constant Source_Ptr := Sloc (Expr);
begin begin
Set_Is_Overloaded (Expr, False); Set_Is_Overloaded (Expr, False);
Rewrite (Expr, Rewrite (Expr,
Make_Explicit_Dereference (Loc, Make_Explicit_Dereference (Loc,
Prefix => Prefix =>
Make_Selected_Component (Loc, Make_Selected_Component (Loc,
Prefix => Relocate_Node (Expr), Prefix => Relocate_Node (Expr),
Selector_Name => Selector_Name => New_Occurrence_Of (Disc, Loc))));
New_Occurrence_Of (Disc, Loc))));
Set_Etype (Prefix (Expr), Etype (Disc)); Set_Etype (Prefix (Expr), Etype (Disc));
Set_Etype (Expr, Designated_Type (Etype (Disc))); Set_Etype (Expr, Designated_Type (Etype (Disc)));
end Build_Explicit_Dereference; end Build_Explicit_Dereference;
...@@ -7178,9 +7175,7 @@ package body Sem_Util is ...@@ -7178,9 +7175,7 @@ package body Sem_Util is
Iface : Entity_Id; Iface : Entity_Id;
begin begin
if not Is_Tagged_Type (Typ) if not Is_Tagged_Type (Typ) or else not Is_Derived_Type (Typ) then
or else not Is_Derived_Type (Typ)
then
return False; return False;
else else
...@@ -7202,45 +7197,7 @@ package body Sem_Util is ...@@ -7202,45 +7197,7 @@ package body Sem_Util is
return False; return False;
end if; end if;
end Is_Iterator; end Is_Iterator;
----------------------------
-- Is_Reversible_Iterator --
----------------------------
function Is_Reversible_Iterator (Typ : Entity_Id) return Boolean is
Ifaces_List : Elist_Id;
Iface_Elmt : Elmt_Id;
Iface : Entity_Id;
begin
if not Is_Tagged_Type (Typ)
or else not Is_Derived_Type (Typ)
then
return False;
else
Collect_Interfaces (Typ, Ifaces_List);
Iface_Elmt := First_Elmt (Ifaces_List);
while Present (Iface_Elmt) loop
Iface := Node (Iface_Elmt);
if Chars (Iface) = Name_Reversible_Iterator
and then
Is_Predefined_File_Name
(Unit_File_Name (Get_Source_Unit (Iface)))
then
return True;
end if;
Next_Elmt (Iface_Elmt);
end loop;
end if;
return False;
end Is_Reversible_Iterator;
------------ ------------
-- Is_LHS -- -- Is_LHS --
------------ ------------
...@@ -7466,15 +7423,15 @@ package body Sem_Util is ...@@ -7466,15 +7423,15 @@ package body Sem_Util is
-- original node is a conversion, then Is_Variable will not be true -- original node is a conversion, then Is_Variable will not be true
-- but we still want to allow the conversion if it converts a variable). -- but we still want to allow the conversion if it converts a variable).
-- In Ada2012, the explicit dereference may be a rewritten call
-- to a Reference function.
elsif Original_Node (AV) /= AV then elsif Original_Node (AV) /= AV then
-- In Ada2012, the explicit dereference may be a rewritten call to a
-- Reference function.
if Ada_Version >= Ada_2012 if Ada_Version >= Ada_2012
and then Nkind (Original_Node (AV)) = N_Function_Call and then Nkind (Original_Node (AV)) = N_Function_Call
and then and then
Has_Implicit_Dereference Has_Implicit_Dereference (Etype (Name (Original_Node (AV))))
(Etype (Name (Original_Node (AV))))
then then
return True; return True;
...@@ -7884,6 +7841,40 @@ package body Sem_Util is ...@@ -7884,6 +7841,40 @@ package body Sem_Util is
return False; return False;
end Is_Renamed_Entry; end Is_Renamed_Entry;
----------------------------
-- Is_Reversible_Iterator --
----------------------------
function Is_Reversible_Iterator (Typ : Entity_Id) return Boolean is
Ifaces_List : Elist_Id;
Iface_Elmt : Elmt_Id;
Iface : Entity_Id;
begin
if not Is_Tagged_Type (Typ) or else not Is_Derived_Type (Typ) then
return False;
else
Collect_Interfaces (Typ, Ifaces_List);
Iface_Elmt := First_Elmt (Ifaces_List);
while Present (Iface_Elmt) loop
Iface := Node (Iface_Elmt);
if Chars (Iface) = Name_Reversible_Iterator
and then
Is_Predefined_File_Name
(Unit_File_Name (Get_Source_Unit (Iface)))
then
return True;
end if;
Next_Elmt (Iface_Elmt);
end loop;
end if;
return False;
end Is_Reversible_Iterator;
---------------------- ----------------------
-- Is_Selector_Name -- -- Is_Selector_Name --
---------------------- ----------------------
......
...@@ -804,17 +804,15 @@ package Sem_Util is ...@@ -804,17 +804,15 @@ package Sem_Util is
-- by a derived type declaration. -- by a derived type declaration.
function Is_Inherited_Operation_For_Type function Is_Inherited_Operation_For_Type
(E : Entity_Id; Typ : Entity_Id) return Boolean; (E : Entity_Id;
Typ : Entity_Id) return Boolean;
-- E is a subprogram. Return True is E is an implicit operation inherited -- E is a subprogram. Return True is E is an implicit operation inherited
-- by the derived type declaration for type Typ. -- by the derived type declaration for type Typ.
function Is_Iterator (Typ : Entity_Id) return Boolean; function Is_Iterator (Typ : Entity_Id) return Boolean;
-- AI05-0139-2 : check whether Typ is derived from the predefined interface -- AI05-0139-2: Check whether Typ is derived from the predefined interface
-- Ada.Iterator_Interfaces.Forward_Iterator. -- Ada.Iterator_Interfaces.Forward_Iterator.
function Is_Reversible_Iterator (Typ : Entity_Id) return Boolean;
-- Ditto for Ada.Iterator_Interfaces.Reversible_Iterator.
function Is_LHS (N : Node_Id) return Boolean; function Is_LHS (N : Node_Id) return Boolean;
-- Returns True iff N is used as Name in an assignment statement -- Returns True iff N is used as Name in an assignment statement
...@@ -882,6 +880,10 @@ package Sem_Util is ...@@ -882,6 +880,10 @@ package Sem_Util is
function Is_Renamed_Entry (Proc_Nam : Entity_Id) return Boolean; function Is_Renamed_Entry (Proc_Nam : Entity_Id) return Boolean;
-- Return True if Proc_Nam is a procedure renaming of an entry -- Return True if Proc_Nam is a procedure renaming of an entry
function Is_Reversible_Iterator (Typ : Entity_Id) return Boolean;
-- AI05-0139-2: Check whether Typ is derived from the predefined interface
-- Ada.Iterator_Interfaces.Reversible_Iterator.
function Is_Selector_Name (N : Node_Id) return Boolean; function Is_Selector_Name (N : Node_Id) return Boolean;
-- Given an N_Identifier node N, determines if it is a Selector_Name. -- Given an N_Identifier node N, determines if it is a Selector_Name.
-- As described in Sinfo, Selector_Names are special because they -- As described in Sinfo, Selector_Names are special because they
......
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