[Ada] Minor reformatting

2018-12-11  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

	* exp_aggr.adb, exp_ch7.adb, gnat1drv.adb, sem_ch10.adb,
	sem_ch13.adb, sem_ch6.adb, sem_ch7.adb, sem_util.adb: Minor
	reformatting.

From-SVN: r266994
This commit is contained in:
Hristian Kirtchev 2018-12-11 11:10:32 +00:00 committed by Pierre-Marie de Rodat
parent 504775519d
commit 2401c98f33
9 changed files with 119 additions and 92 deletions

View File

@ -1,3 +1,9 @@
2018-12-11 Hristian Kirtchev <kirtchev@adacore.com>
* exp_aggr.adb, exp_ch7.adb, gnat1drv.adb, sem_ch10.adb,
sem_ch13.adb, sem_ch6.adb, sem_ch7.adb, sem_util.adb: Minor
reformatting.
2018-12-11 Eric Botcazou <ebotcazou@adacore.com> 2018-12-11 Eric Botcazou <ebotcazou@adacore.com>
* fe.h (Is_Atomic_Object): Declare. * fe.h (Is_Atomic_Object): Declare.

View File

@ -7687,6 +7687,7 @@ package body Exp_Aggr is
is is
In_Obj_Decl : Boolean := False; In_Obj_Decl : Boolean := False;
P : Node_Id := Parent (N); P : Node_Id := Parent (N);
begin begin
while Present (P) loop while Present (P) loop
if Nkind (P) = N_Object_Declaration then if Nkind (P) = N_Object_Declaration then
@ -8524,28 +8525,27 @@ package body Exp_Aggr is
---------------------------- ----------------------------
function Static_Array_Aggregate (N : Node_Id) return Boolean is function Static_Array_Aggregate (N : Node_Id) return Boolean is
function Is_Static_Component (Nod : Node_Id) return Boolean;
function Is_Static_Component (N : Node_Id) return Boolean; -- Return True if Nod has a compile-time known value and can be passed
-- Return True if N has a compile-time known value and can be passed as -- as is to the back-end without further expansion.
-- is to the back-end without further expansion.
--------------------------- ---------------------------
-- Is_Static_Component -- -- Is_Static_Component --
--------------------------- ---------------------------
function Is_Static_Component (N : Node_Id) return Boolean is function Is_Static_Component (Nod : Node_Id) return Boolean is
begin begin
if Nkind_In (N, N_Integer_Literal, N_Real_Literal) then if Nkind_In (Nod, N_Integer_Literal, N_Real_Literal) then
return True; return True;
elsif Is_Entity_Name (N) elsif Is_Entity_Name (Nod)
and then Present (Entity (N)) and then Present (Entity (Nod))
and then Ekind (Entity (N)) = E_Enumeration_Literal and then Ekind (Entity (Nod)) = E_Enumeration_Literal
then then
return True; return True;
elsif Nkind (N) = N_Aggregate elsif Nkind (Nod) = N_Aggregate
and then Compile_Time_Known_Aggregate (N) and then Compile_Time_Known_Aggregate (Nod)
then then
return True; return True;
@ -8554,13 +8554,15 @@ package body Exp_Aggr is
end if; end if;
end Is_Static_Component; end Is_Static_Component;
Bounds : constant Node_Id := Aggregate_Bounds (N); -- Local variables
Typ : constant Entity_Id := Etype (N); Bounds : constant Node_Id := Aggregate_Bounds (N);
Agg : Node_Id; Typ : constant Entity_Id := Etype (N);
Expr : Node_Id;
Lo : Node_Id; Agg : Node_Id;
Hi : Node_Id; Expr : Node_Id;
Lo : Node_Id;
Hi : Node_Id;
-- Start of processing for Static_Array_Aggregate -- Start of processing for Static_Array_Aggregate

View File

@ -4005,14 +4005,14 @@ package body Exp_Ch7 is
-- may need an activation record. -- may need an activation record.
function First_Local_Scope (L : List_Id) return Entity_Id; function First_Local_Scope (L : List_Id) return Entity_Id;
-- Find first entity in the elaboration code of the body that -- Find first entity in the elaboration code of the body that contains
-- contains or represents a subprogrsam body. A body can appear -- or represents a subprogram body. A body can appear within a block or
-- within a block or a loop. or can appear by itself if generated -- a loop or can appear by itself if generated for an object declaration
-- for an object declaration that involves controlled actions. -- that involves controlled actions. The first such entity encountered
-- The first such entity encountered is used to reset the scopes -- is used to reset the scopes of all entities that become local to the
-- of all entities that become local to the hew elboration procedure. -- new elaboration procedure. This is needed for subsequent unnesting,
-- This is needed for subsequent unnesting, which depends on the -- which depends on the scope links to determine the nesting level of
-- scope links to determine the nesting level of each subprogram. -- each subprogram.
-------------------------- --------------------------
-- Contains_Subprogram -- -- Contains_Subprogram --
@ -4023,7 +4023,6 @@ package body Exp_Ch7 is
begin begin
E := First_Entity (Blk); E := First_Entity (Blk);
while Present (E) loop while Present (E) loop
if Is_Subprogram (E) then if Is_Subprogram (E) then
return True; return True;
@ -4055,6 +4054,7 @@ package body Exp_Ch7 is
case Nkind (Stat) is case Nkind (Stat) is
when N_Block_Statement => when N_Block_Statement =>
Id := Entity (Identifier (Stat)); Id := Entity (Identifier (Stat));
if No (First_Ent) then if No (First_Ent) then
First_Ent := Id; First_Ent := Id;
end if; end if;
@ -4065,6 +4065,7 @@ package body Exp_Ch7 is
when N_Loop_Statement => when N_Loop_Statement =>
Id := Entity (Identifier (Stat)); Id := Entity (Identifier (Stat));
if No (First_Ent) then if No (First_Ent) then
First_Ent := Id; First_Ent := Id;
end if; end if;
@ -4092,9 +4093,9 @@ package body Exp_Ch7 is
declare declare
Elif : Node_Id; Elif : Node_Id;
begin begin
Elif := First (Elsif_Parts (Stat)); Elif := First (Elsif_Parts (Stat));
while Present (Elif) loop while Present (Elif) loop
Scop := First_Local_Scope (Statements (Elif)); Scop := First_Local_Scope (Statements (Elif));
@ -4109,9 +4110,9 @@ package body Exp_Ch7 is
when N_Case_Statement => when N_Case_Statement =>
declare declare
Alt : Node_Id; Alt : Node_Id;
begin begin
Alt := First (Alternatives (Stat)); Alt := First (Alternatives (Stat));
while Present (Alt) loop while Present (Alt) loop
Scop := First_Local_Scope (Statements (Alt)); Scop := First_Local_Scope (Statements (Alt));
@ -4125,6 +4126,7 @@ package body Exp_Ch7 is
when N_Subprogram_Body => when N_Subprogram_Body =>
Id := Defining_Entity (Stat); Id := Defining_Entity (Stat);
if No (First_Ent) then if No (First_Ent) then
First_Ent := Id; First_Ent := Id;
end if; end if;
@ -4156,8 +4158,7 @@ package body Exp_Ch7 is
and then Present (H_Seq) and then Present (H_Seq)
and then Is_Compilation_Unit (Current_Scope) and then Is_Compilation_Unit (Current_Scope)
then then
Ent := Ent := First_Local_Scope (Statements (H_Seq));
First_Local_Scope (Statements (H_Seq));
-- There msy be subprograms declared in the exception handlers -- There msy be subprograms declared in the exception handlers
-- of the current body. -- of the current body.

View File

@ -1168,8 +1168,9 @@ begin
-- error message but do not print the internal 'usage' message. -- error message but do not print the internal 'usage' message.
if GNATprove_Mode then if GNATprove_Mode then
Write_Str ("one of the following is not a valid switch" Write_Str
& " or source file name: "); ("one of the following is not a valid switch or source file "
& "name: ");
Osint.Dump_Command_Line_Source_File_Names; Osint.Dump_Command_Line_Source_File_Names;
else else
Usage; Usage;

View File

@ -2352,8 +2352,8 @@ package body Sem_Ch10 is
Remove_Scope; Remove_Scope;
end if; end if;
if Nkind_In if Nkind_In (Unit (Lib_Spec), N_Package_Body,
(Unit (Lib_Spec), N_Package_Body, N_Subprogram_Body) N_Subprogram_Body)
then then
Remove_Context (Library_Unit (Lib_Spec)); Remove_Context (Library_Unit (Lib_Spec));
end if; end if;

View File

@ -5708,6 +5708,7 @@ package body Sem_Ch13 is
Assoc := First (Component_Associations (Expr)); Assoc := First (Component_Associations (Expr));
while Present (Assoc) loop while Present (Assoc) loop
Analyze (Expression (Assoc)); Analyze (Expression (Assoc));
if not Is_Entity_Name (Expression (Assoc)) then if not Is_Entity_Name (Expression (Assoc)) then
Error_Msg_N ("value must be a function", Assoc); Error_Msg_N ("value must be a function", Assoc);
end if; end if;
@ -9363,7 +9364,7 @@ package body Sem_Ch13 is
-- The following aspect expressions may contain references to -- The following aspect expressions may contain references to
-- components and discriminants of the type. -- components and discriminants of the type.
elsif A_Id = Aspect_Dynamic_Predicate elsif A_Id = Aspect_Dynamic_Predicate
or else A_Id = Aspect_Predicate or else A_Id = Aspect_Predicate
or else A_Id = Aspect_Priority or else A_Id = Aspect_Priority
then then
@ -9375,7 +9376,8 @@ package body Sem_Ch13 is
Preanalyze_Spec_Expression (End_Decl_Expr, T); Preanalyze_Spec_Expression (End_Decl_Expr, T);
end if; end if;
Err := not Fully_Conformant_Expressions Err :=
not Fully_Conformant_Expressions
(End_Decl_Expr, Freeze_Expr, Report => True); (End_Decl_Expr, Freeze_Expr, Report => True);
end if; end if;
@ -11239,8 +11241,8 @@ package body Sem_Ch13 is
and then Scope (E) = Current_Scope and then Scope (E) = Current_Scope
then then
declare declare
A_Id : Aspect_Id;
Ritem : Node_Id; Ritem : Node_Id;
A_Id : Aspect_Id;
begin begin
-- Look for aspect specification entries for this entity -- Look for aspect specification entries for this entity
@ -11252,6 +11254,7 @@ package body Sem_Ch13 is
and then Is_Delayed_Aspect (Ritem) and then Is_Delayed_Aspect (Ritem)
then then
A_Id := Get_Aspect_Id (Ritem); A_Id := Get_Aspect_Id (Ritem);
if A_Id = Aspect_Dynamic_Predicate if A_Id = Aspect_Dynamic_Predicate
or else A_Id = Aspect_Predicate or else A_Id = Aspect_Predicate
or else A_Id = Aspect_Priority or else A_Id = Aspect_Priority
@ -11274,10 +11277,10 @@ package body Sem_Ch13 is
end if; end if;
-- For a record type, deal with variant parts. This has to be delayed -- For a record type, deal with variant parts. This has to be delayed to
-- to this point, because of the issue of statically predicated -- this point, because of the issue of statically predicated subtypes,
-- subtypes, which we have to ensure are frozen before checking -- which we have to ensure are frozen before checking choices, since we
-- choices, since we need to have the static choice list set. -- need to have the static choice list set.
if Is_Record_Type (E) then if Is_Record_Type (E) then
Check_Variant_Part : declare Check_Variant_Part : declare
@ -12456,15 +12459,35 @@ package body Sem_Ch13 is
end if; end if;
end New_Stream_Subprogram; end New_Stream_Subprogram;
--------------
-- Pop_Type --
--------------
procedure Pop_Type (E : Entity_Id) is
begin
if Ekind (E) = E_Record_Type and then E = Current_Scope then
End_Scope;
elsif Is_Type (E)
and then Has_Discriminants (E)
and then Nkind (Parent (E)) /= N_Subtype_Declaration
then
Uninstall_Discriminants (E);
Pop_Scope;
end if;
end Pop_Type;
--------------- ---------------
-- Push_Type -- -- Push_Type --
--------------- ---------------
procedure Push_Type (E : Entity_Id) is procedure Push_Type (E : Entity_Id) is
Comp : Entity_Id; Comp : Entity_Id;
begin begin
if Ekind (E) = E_Record_Type then if Ekind (E) = E_Record_Type then
Push_Scope (E); Push_Scope (E);
Comp := First_Component (E); Comp := First_Component (E);
while Present (Comp) loop while Present (Comp) loop
Install_Entity (Comp); Install_Entity (Comp);
@ -12476,8 +12499,8 @@ package body Sem_Ch13 is
end if; end if;
elsif Is_Type (E) elsif Is_Type (E)
and then Has_Discriminants (E) and then Has_Discriminants (E)
and then Nkind (Parent (E)) /= N_Subtype_Declaration and then Nkind (Parent (E)) /= N_Subtype_Declaration
then then
Push_Scope (E); Push_Scope (E);
Install_Discriminants (E); Install_Discriminants (E);
@ -12559,9 +12582,6 @@ package body Sem_Ch13 is
N : Node_Id; N : Node_Id;
FOnly : Boolean := False) return Boolean FOnly : Boolean := False) return Boolean
is is
S : Entity_Id;
Parent_Type : Entity_Id;
function Is_Derived_Type_With_Constraint return Boolean; function Is_Derived_Type_With_Constraint return Boolean;
-- Check whether T is a derived type with an explicit constraint, in -- Check whether T is a derived type with an explicit constraint, in
-- which case the constraint has frozen the type and the item is too -- which case the constraint has frozen the type and the item is too
@ -12589,6 +12609,7 @@ package body Sem_Ch13 is
function Is_Derived_Type_With_Constraint return Boolean is function Is_Derived_Type_With_Constraint return Boolean is
Decl : constant Node_Id := Declaration_Node (T); Decl : constant Node_Id := Declaration_Node (T);
begin begin
return Is_Derived_Type (T) return Is_Derived_Type (T)
and then Is_Frozen (Base_Type (T)) and then Is_Frozen (Base_Type (T))
@ -12623,14 +12644,19 @@ package body Sem_Ch13 is
end if; end if;
end Too_Late; end Too_Late;
-- Local variables
Parent_Type : Entity_Id;
S : Entity_Id;
-- Start of processing for Rep_Item_Too_Late -- Start of processing for Rep_Item_Too_Late
begin begin
-- First make sure entity is not frozen (RM 13.1(9)) -- First make sure entity is not frozen (RM 13.1(9))
if (Is_Frozen (T) if (Is_Frozen (T)
or else (Is_Type (T) or else (Is_Type (T)
and then Is_Derived_Type_With_Constraint)) and then Is_Derived_Type_With_Constraint))
-- Exclude imported types, which may be frozen if they appear in a -- Exclude imported types, which may be frozen if they appear in a
-- representation clause for a local type. -- representation clause for a local type.
@ -13679,25 +13705,6 @@ package body Sem_Ch13 is
end if; end if;
end Uninstall_Discriminants; end Uninstall_Discriminants;
--------------
-- Pop_Type --
--------------
procedure Pop_Type (E : Entity_Id) is
begin
if Ekind (E) = E_Record_Type and then E = Current_Scope then
End_Scope;
return;
elsif Is_Type (E)
and then Has_Discriminants (E)
and then Nkind (Parent (E)) /= N_Subtype_Declaration
then
Uninstall_Discriminants (E);
Pop_Scope;
end if;
end Pop_Type;
------------------------------ ------------------------------
-- Validate_Address_Clauses -- -- Validate_Address_Clauses --
------------------------------ ------------------------------

View File

@ -8832,27 +8832,33 @@ package body Sem_Ch6 is
-- for analysis and/or expansion to make things look as though they -- for analysis and/or expansion to make things look as though they
-- conform when they do not, e.g. by converting 1+2 into 3. -- conform when they do not, e.g. by converting 1+2 into 3.
Result : Boolean; function FCE (Given_E1 : Node_Id; Given_E2 : Node_Id) return Boolean;
function FCE (Given_E1, Given_E2 : Node_Id) return Boolean; -- ???
function FCE (Given_E1, Given_E2 : Node_Id) return Boolean is
begin
return Fully_Conformant_Expressions (Given_E1, Given_E2, Report);
end FCE;
function FCL (L1, L2 : List_Id) return Boolean; function FCL (L1 : List_Id; L2 : List_Id) return Boolean;
-- Compare elements of two lists for conformance. Elements have to be -- Compare elements of two lists for conformance. Elements have to be
-- conformant, and actuals inserted as default parameters do not match -- conformant, and actuals inserted as default parameters do not match
-- explicit actuals with the same value. -- explicit actuals with the same value.
function FCO (Op_Node, Call_Node : Node_Id) return Boolean; function FCO (Op_Node : Node_Id; Call_Node : Node_Id) return Boolean;
-- Compare an operator node with a function call -- Compare an operator node with a function call
---------
-- FCE --
---------
function FCE (Given_E1 : Node_Id; Given_E2 : Node_Id) return Boolean is
begin
return Fully_Conformant_Expressions (Given_E1, Given_E2, Report);
end FCE;
--------- ---------
-- FCL -- -- FCL --
--------- ---------
function FCL (L1, L2 : List_Id) return Boolean is function FCL (L1 : List_Id; L2 : List_Id) return Boolean is
N1, N2 : Node_Id; N1 : Node_Id;
N2 : Node_Id;
begin begin
if L1 = No_List then if L1 = No_List then
@ -8892,7 +8898,7 @@ package body Sem_Ch6 is
-- FCO -- -- FCO --
--------- ---------
function FCO (Op_Node, Call_Node : Node_Id) return Boolean is function FCO (Op_Node : Node_Id; Call_Node : Node_Id) return Boolean is
Actuals : constant List_Id := Parameter_Associations (Call_Node); Actuals : constant List_Id := Parameter_Associations (Call_Node);
Act : Node_Id; Act : Node_Id;
@ -8919,6 +8925,10 @@ package body Sem_Ch6 is
end if; end if;
end FCO; end FCO;
-- Local variables
Result : Boolean;
-- Start of processing for Fully_Conformant_Expressions -- Start of processing for Fully_Conformant_Expressions
begin begin

View File

@ -2737,10 +2737,11 @@ package body Sem_Ch7 is
-- to the same freeze node as their corresponding full view, if any. -- to the same freeze node as their corresponding full view, if any.
-- But we ought not to overwrite a node already inserted in the tree. -- But we ought not to overwrite a node already inserted in the tree.
pragma Assert (Serious_Errors_Detected /= 0 pragma Assert
or else No (Freeze_Node (Priv)) (Serious_Errors_Detected /= 0
or else No (Parent (Freeze_Node (Priv))) or else No (Freeze_Node (Priv))
or else Freeze_Node (Priv) = Freeze_Node (Full)); or else No (Parent (Freeze_Node (Priv)))
or else Freeze_Node (Priv) = Freeze_Node (Full));
Set_Freeze_Node (Priv, Freeze_Node (Full)); Set_Freeze_Node (Priv, Freeze_Node (Full));

View File

@ -14137,11 +14137,11 @@ package body Sem_Util is
Deref := Expression (Deref); Deref := Expression (Deref);
end if; end if;
-- Ada 2005: If we have a component or slice of a dereference, -- Ada 2005: If we have a component or slice of a dereference, something
-- something like X.all.Y (2), and the type of X is access-to-constant, -- like X.all.Y (2) and the type of X is access-to-constant, Is_Variable
-- Is_Variable will return False, because it is indeed a constant -- will return False, because it is indeed a constant view. But it might
-- view. But it might be a view of a variable object, so we want the -- be a view of a variable object, so we want the following condition to
-- following condition to be True in that case. -- be True in that case.
if Is_Variable (Object) if Is_Variable (Object)
or else Is_Variable (Deref) or else Is_Variable (Deref)
@ -14155,9 +14155,8 @@ package body Sem_Util is
-- False (it could be a function selector in a prefix form call -- False (it could be a function selector in a prefix form call
-- occurring in an iterator specification). -- occurring in an iterator specification).
if not if not Ekind_In (Entity (Selector_Name (Object)), E_Component,
Ekind_In E_Discriminant)
(Entity (Selector_Name (Object)), E_Component, E_Discriminant)
then then
return False; return False;
end if; end if;
@ -14172,8 +14171,8 @@ package body Sem_Util is
P := Original_Node (Prefix (Object)); P := Original_Node (Prefix (Object));
Prefix_Type := Etype (P); Prefix_Type := Etype (P);
-- If the prefix is a qualified expression, we want to look at -- If the prefix is a qualified expression, we want to look at its
-- its operand. -- operand.
if Nkind (P) = N_Qualified_Expression then if Nkind (P) = N_Qualified_Expression then
P := Expression (P); P := Expression (P);