sem_aggr.adb, [...]: Minor reformatting & code reorganization.

2014-08-01  Robert Dewar  <dewar@adacore.com>

	* sem_aggr.adb, exp_atag.adb, layout.adb, nlists.adb, nlists.ads,
	exp_attr.adb, exp_ch9.adb, par-ch12.adb, exp_aggr.adb,
	exp_ch3.adb: Minor reformatting & code reorganization.

From-SVN: r213439
This commit is contained in:
Robert Dewar 2014-08-01 09:57:04 +00:00 committed by Arnaud Charlet
parent e08add8ea9
commit 37368818b9
11 changed files with 94 additions and 92 deletions

View File

@ -1,3 +1,9 @@
2014-08-01 Robert Dewar <dewar@adacore.com>
* sem_aggr.adb, exp_atag.adb, layout.adb, nlists.adb, nlists.ads,
exp_attr.adb, exp_ch9.adb, par-ch12.adb, exp_aggr.adb,
exp_ch3.adb: Minor reformatting & code reorganization.
2014-08-01 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Remove VMS specific rules for pragma Ident.

View File

@ -1163,9 +1163,9 @@ package body Exp_Aggr is
if Needs_Finalization (Ctype) then
Append_To (L,
Make_Init_Call (
Obj_Ref => New_Copy_Tree (Indexed_Comp),
Typ => Ctype));
Make_Init_Call
(Obj_Ref => New_Copy_Tree (Indexed_Comp),
Typ => Ctype));
end if;
else
@ -1262,9 +1262,9 @@ package body Exp_Aggr is
and then Nkind (Expr) = N_Aggregate)
then
Append_To (L,
Make_Adjust_Call (
Obj_Ref => New_Copy_Tree (Indexed_Comp),
Typ => Comp_Type));
Make_Adjust_Call
(Obj_Ref => New_Copy_Tree (Indexed_Comp),
Typ => Comp_Type));
end if;
end if;
@ -1406,11 +1406,12 @@ package body Exp_Aggr is
-- Construct the final loop
Append_To (S, Make_Implicit_Loop_Statement
(Node => N,
Identifier => Empty,
Iteration_Scheme => L_Iteration_Scheme,
Statements => L_Body));
Append_To (S,
Make_Implicit_Loop_Statement
(Node => N,
Identifier => Empty,
Iteration_Scheme => L_Iteration_Scheme,
Statements => L_Body));
-- A small optimization: if the aggregate is initialized with a box
-- and the component type has no initialization procedure, remove the
@ -1513,11 +1514,12 @@ package body Exp_Aggr is
-- Construct the final loop
Append_To (S, Make_Implicit_Loop_Statement
(Node => N,
Identifier => Empty,
Iteration_Scheme => W_Iteration_Scheme,
Statements => W_Body));
Append_To (S,
Make_Implicit_Loop_Statement
(Node => N,
Identifier => Empty,
Iteration_Scheme => W_Iteration_Scheme,
Statements => W_Body));
return S;
end Gen_While;
@ -1604,7 +1606,7 @@ package body Exp_Aggr is
then
Append_To (New_Code,
Make_Assignment_Statement (Loc,
Name => New_Copy_Tree (Into),
Name => New_Copy_Tree (Into),
Expression =>
Unchecked_Convert_To (Typ,
Make_Integer_Literal (Loc, Uint_0))));
@ -2186,7 +2188,7 @@ package body Exp_Aggr is
Append_To (L,
Make_Procedure_Call_Statement (Loc,
Name =>
Name =>
New_Occurrence_Of
(Find_Prim_Op (Init_Typ, Name_Initialize), Loc),
Parameter_Associations => New_List (New_Copy_Tree (Ref))));
@ -2510,9 +2512,9 @@ package body Exp_Aggr is
and then not Is_Limited_Type (Etype (Ancestor))
then
Append_To (Assign,
Make_Adjust_Call (
Obj_Ref => New_Copy_Tree (Ref),
Typ => Etype (Ancestor)));
Make_Adjust_Call
(Obj_Ref => New_Copy_Tree (Ref),
Typ => Etype (Ancestor)));
end if;
Append_To (L,
@ -2628,9 +2630,8 @@ package body Exp_Aggr is
if Nkind (N) = N_Aggregate then
Append_To (L,
Make_Procedure_Call_Statement (Loc,
Name =>
New_Occurrence_Of
(Base_Init_Proc (CPP_Parent), Loc),
Name =>
New_Occurrence_Of (Base_Init_Proc (CPP_Parent), Loc),
Parameter_Associations => New_List (
Unchecked_Convert_To (CPP_Parent,
New_Copy_Tree (Lhs)))));
@ -2655,10 +2656,10 @@ package body Exp_Aggr is
if Is_CPP_Constructor_Call (Expression (Comp)) then
Append_List_To (L,
Build_Initialization_Call (Loc,
Id_Ref => Make_Selected_Component (Loc,
Prefix => New_Copy_Tree (Target),
Selector_Name =>
New_Occurrence_Of (Selector, Loc)),
Id_Ref =>
Make_Selected_Component (Loc,
Prefix => New_Copy_Tree (Target),
Selector_Name => New_Occurrence_Of (Selector, Loc)),
Typ => Etype (Selector),
Enclos_Type => Typ,
With_Default_Init => True,
@ -2911,13 +2912,13 @@ package body Exp_Aggr is
and then not Is_Limited_Type (Comp_Type)
then
Append_To (L,
Make_Adjust_Call (
Obj_Ref => New_Copy_Tree (Comp_Expr),
Typ => Comp_Type));
Make_Adjust_Call
(Obj_Ref => New_Copy_Tree (Comp_Expr),
Typ => Comp_Type));
end if;
end if;
-- ???
-- comment would be good here ???
elsif Ekind (Selector) = E_Discriminant
and then Nkind (N) /= N_Extension_Aggregate
@ -2955,9 +2956,9 @@ package body Exp_Aggr is
Make_Raise_Constraint_Error (Loc,
Condition =>
Make_Op_Ne (Loc,
Left_Opnd => New_Copy_Tree (Node (D_Val)),
Left_Opnd => New_Copy_Tree (Node (D_Val)),
Right_Opnd => Expression (Comp)),
Reason => CE_Discriminant_Check_Failed));
Reason => CE_Discriminant_Check_Failed));
else
-- Find self-reference in previous discriminant assignment,
@ -4199,7 +4200,7 @@ package body Exp_Aggr is
Append_To (Indexes,
Make_Range (Loc,
Low_Bound => Make_Integer_Literal (Loc, 1),
Low_Bound => Make_Integer_Literal (Loc, 1),
High_Bound => Make_Integer_Literal (Loc, Num)));
end loop;
@ -4209,11 +4210,10 @@ package body Exp_Aggr is
-- positional. Retrieve each dimension bounds (computed earlier).
for D in 1 .. Number_Dimensions (Typ) loop
Append (
Append_To (Indexes,
Make_Range (Loc,
Low_Bound => Aggr_Low (D),
High_Bound => Aggr_High (D)),
Indexes);
Low_Bound => Aggr_Low (D),
High_Bound => Aggr_High (D)));
end loop;
end if;
@ -6097,11 +6097,11 @@ package body Exp_Aggr is
Discriminant := First_Stored_Discriminant (Base_Type (Typ));
while Present (Discriminant) loop
New_Comp :=
New_Copy_Tree (
Get_Discriminant_Value (
Discriminant,
Typ,
Discriminant_Constraint (Typ)));
New_Copy_Tree
(Get_Discriminant_Value
(Discriminant,
Typ,
Discriminant_Constraint (Typ)));
Append (New_Comp, Constraints);
Next_Stored_Discriminant (Discriminant);
end loop;
@ -6173,8 +6173,7 @@ package body Exp_Aggr is
Make_Component_Association (Loc,
Choices =>
New_List (New_Occurrence_Of (Comp, Loc)),
Expression =>
New_Comp));
Expression => New_Comp));
Analyze_And_Resolve (New_Comp, Etype (Comp));
end if;
@ -7135,8 +7134,7 @@ package body Exp_Aggr is
for I in UI_To_Int (Intval (Lo)) .. UI_To_Int (Intval (Hi))
loop
Append_To
(Expressions (Agg), New_Copy (Expression (Expr)));
Append_To (Expressions (Agg), New_Copy (Expression (Expr)));
-- The copied expression must be analyzed and resolved.
-- Besides setting the type, this ensures that static

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2006-2013, Free Software Foundation, Inc. --
-- Copyright (C) 2006-2014, 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- --
@ -99,10 +99,11 @@ package body Exp_Atag is
Append_To (Stmts,
Make_Assignment_Statement (Loc,
Name => Make_Identifier (Loc, Name_uC),
Name => Make_Identifier (Loc, Name_uC),
Expression =>
Make_Function_Call (Loc,
Name => New_Occurrence_Of (RTE (RE_Get_Prim_Op_Kind), Loc),
Name =>
New_Occurrence_Of (RTE (RE_Get_Prim_Op_Kind), Loc),
Parameter_Associations => New_List (
Tag_Node,
Make_Identifier (Loc, Name_uS)))));
@ -415,9 +416,9 @@ package body Exp_Atag is
Append_To (Result,
Make_Assignment_Statement (Loc,
Name =>
Name =>
Make_Indexed_Component (Loc,
Prefix =>
Prefix =>
Make_Explicit_Dereference (Loc,
Unchecked_Convert_To
(Node (Last_Elmt (Access_Disp_Table (Typ))),
@ -428,7 +429,7 @@ package body Exp_Atag is
Expression =>
Unchecked_Convert_To (RTE (RE_Prim_Ptr),
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (E, Loc),
Prefix => New_Occurrence_Of (E, Loc),
Attribute_Name => Name_Unrestricted_Access))));
end if;
@ -455,7 +456,7 @@ package body Exp_Atag is
if not CPP_Table (J) then
Prepend_To (Result,
Make_Assignment_Statement (Loc,
Name =>
Name =>
Make_Explicit_Dereference (Loc,
Unchecked_Convert_To
(Node (Last_Elmt (Access_Disp_Table (CPP_Typ))),
@ -550,14 +551,14 @@ package body Exp_Atag is
Append_To (Result,
Make_Assignment_Statement (Loc,
Name =>
Name =>
Make_Indexed_Component (Loc,
Prefix =>
Prefix =>
Make_Explicit_Dereference (Loc,
Unchecked_Convert_To
(Node
(Last_Elmt
(Access_Disp_Table (Iface))),
(Access_Disp_Table (Iface))),
New_Occurrence_Of (Typ_Tag, Loc))),
Expressions =>
New_List
@ -566,7 +567,7 @@ package body Exp_Atag is
Expression =>
Unchecked_Convert_To (RTE (RE_Prim_Ptr),
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (E, Loc),
Prefix => New_Occurrence_Of (E, Loc),
Attribute_Name =>
Name_Unrestricted_Access))));
end if;
@ -584,7 +585,7 @@ package body Exp_Atag is
if not Prims_Table (J) then
Insert_After (Last_Nod,
Make_Assignment_Statement (Loc,
Name =>
Name =>
Make_Explicit_Dereference (Loc,
Unchecked_Convert_To
(Node (Last_Elmt (Access_Disp_Table (Iface))),

View File

@ -459,14 +459,14 @@ package body Exp_Attr is
Append_To (Alt_List,
Make_Case_Statement_Alternative (Loc,
Discrete_Choices => New_Copy_List (Discrete_Choices (Variant)),
Statements =>
Statements =>
Make_VS_Case (E, Component_List (Variant), Discrs)));
Next_Non_Pragma (Variant);
end loop;
Append_To (Result,
Make_Case_Statement (Loc,
Expression =>
Expression =>
Make_Selected_Component (Loc,
Prefix => Make_Identifier (Loc, Name_X),
Selector_Name => New_Copy (Name (Variant_Part (CL)))),

View File

@ -2350,8 +2350,7 @@ package body Exp_Ch3 is
if not Null_Present (Type_Definition (N)) then
Append_List_To (Body_Stmts,
Build_Init_Statements (
Component_List (Type_Definition (N))));
Build_Init_Statements (Component_List (Type_Definition (N))));
end if;
-- N is a Derived_Type_Definition with a possible non-empty
@ -4459,8 +4458,7 @@ package body Exp_Ch3 is
-- the case statement switch. Their value is added when an
-- equality call on unchecked unions is expanded.
Append_List_To (Stmts,
Make_Eq_Case (Typ, Comps, New_Discrs));
Append_List_To (Stmts, Make_Eq_Case (Typ, Comps, New_Discrs));
end;
-- Normal case (not unchecked union)

View File

@ -10624,14 +10624,13 @@ package body Exp_Ch9 is
Params : constant List_Id := New_List;
begin
Append (
Append_To (Params,
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (Qnam, Loc),
Attribute_Name => Name_Unchecked_Access),
Params);
Append (Select_Mode, Params);
Append (New_Occurrence_Of (Ann, Loc), Params);
Append (New_Occurrence_Of (Xnam, Loc), Params);
Attribute_Name => Name_Unchecked_Access));
Append_To (Params, Select_Mode);
Append_To (Params, New_Occurrence_Of (Ann, Loc));
Append_To (Params, New_Occurrence_Of (Xnam, Loc));
return
Make_Procedure_Call_Statement (Loc,
@ -11351,6 +11350,7 @@ package body Exp_Ch9 is
Append (Cases, Stats);
end;
end if;
Append (End_Lab, Stats);
-- Replace accept statement with appropriate block

View File

@ -2195,13 +2195,12 @@ package body Layout is
D_List := New_List;
D_Entity := First_Discriminant (E);
while Present (D_Entity) loop
Append (
Append_To (D_List,
Make_Selected_Component (Loc,
Prefix =>
Make_Identifier (Loc, Vname),
Selector_Name =>
New_Occurrence_Of (D_Entity, Loc)),
D_List);
New_Occurrence_Of (D_Entity, Loc)));
D_Entity := Next_Discriminant (D_Entity);
end loop;

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- Copyright (C) 1992-2014, 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- --
@ -744,8 +744,8 @@ package body Nlists is
else
NL := New_List;
E := First (List);
E := First (List);
while Present (E) loop
if Comes_From_Source (E) then
Append (New_Copy (E), NL);

View File

@ -225,9 +225,9 @@ package Nlists is
procedure Append (Node : Node_Or_Entity_Id; To : List_Id);
-- Appends Node at the end of node list To. Node must be a non-empty node
-- that is not already a member of a node list, and To must be a
-- node list. An attempt to append an error node is ignored without
-- complaint and the list is unchanged.
-- that is not already a member of a node list, and To must be a node list.
-- An attempt to append an error node is ignored without complaint and the
-- list is unchanged.
procedure Append_To (To : List_Id; Node : Node_Or_Entity_Id);
pragma Inline (Append_To);

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- Copyright (C) 1992-2014, 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- --
@ -168,6 +168,7 @@ package body Ch12 is
if Token = Tok_Use then
Append (P_Use_Clause, Decls);
else
-- Parse a generic parameter declaration

View File

@ -4355,13 +4355,12 @@ package body Sem_Aggr is
end if;
if Needs_Box then
Append
(Make_Component_Association (Loc,
Choices =>
New_List (Make_Others_Choice (Loc)),
Expression => Empty,
Box_Present => True),
Component_Associations (Aggr));
Append_To (Component_Associations (Aggr),
Make_Component_Association (Loc,
Choices =>
New_List (Make_Others_Choice (Loc)),
Expression => Empty,
Box_Present => True));
end if;
end Propagate_Discriminants;
@ -4400,14 +4399,14 @@ package body Sem_Aggr is
while Present (Comp) loop
if Ekind (Comp) = E_Component then
if not Is_Record_Type (Etype (Comp)) then
Append
(Make_Component_Association (Loc,
Append_To
(Component_Associations (Expr),
Make_Component_Association (Loc,
Choices =>
New_List
(Make_Others_Choice (Loc)),
Expression => Empty,
Box_Present => True),
Component_Associations (Expr));
Box_Present => True));
end if;
exit;
end if;