Commit 29c64a0f by Hristian Kirtchev Committed by Pierre-Marie de Rodat

[Ada] Minor reformatting

2019-07-11  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

	* checks.adb, exp_ch6.adb, gnat1drv.adb, sem_aux.adb,
	sem_ch2.adb, sem_ch8.adb, sem_res.adb: Minor reformatting.

From-SVN: r273388
parent bce6accb
2019-07-11 Hristian Kirtchev <kirtchev@adacore.com>
* checks.adb, exp_ch6.adb, gnat1drv.adb, sem_aux.adb,
sem_ch2.adb, sem_ch8.adb, sem_res.adb: Minor reformatting.
2019-07-11 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch8.adb (Analyze_Object_Renaming): Obtain the object being
renamed using routine Get_Object_Name which takes care of
various name forms.
......
......@@ -577,9 +577,10 @@ package body Checks is
Typ : Entity_Id;
Insert_Node : Node_Id)
is
Loc : constant Source_Ptr := Sloc (N);
Check_Cond : Node_Id;
Loc : constant Source_Ptr := Sloc (N);
Param_Ent : Entity_Id := Param_Entity (N);
Param_Ent : Entity_Id := Param_Entity (N);
Param_Level : Node_Id;
Type_Level : Node_Id;
......@@ -639,9 +640,10 @@ package body Checks is
-- Raise Program_Error if the accessibility level of the access
-- parameter is deeper than the level of the target access type.
Check_Cond := Make_Op_Gt (Loc,
Left_Opnd => Param_Level,
Right_Opnd => Type_Level);
Check_Cond :=
Make_Op_Gt (Loc,
Left_Opnd => Param_Level,
Right_Opnd => Type_Level);
Insert_Action (Insert_Node,
Make_Raise_Program_Error (Loc,
......@@ -657,10 +659,8 @@ package body Checks is
and then Entity (Check_Cond) = Standard_True
then
Error_Msg_Warn := SPARK_Mode /= On;
Error_Msg_N
("accessibility check fails<<", N);
Error_Msg_N
("\Program_Error [<<", N);
Error_Msg_N ("accessibility check fails<<", N);
Error_Msg_N ("\Program_Error [<<", N);
end if;
end if;
end Apply_Accessibility_Check;
......
......@@ -2481,8 +2481,6 @@ package body Exp_Ch6 is
function Can_Fold_Predicate_Call (P : Entity_Id) return Boolean is
Actual : constant Node_Id :=
First (Parameter_Associations (Call_Node));
Subt : constant Entity_Id := Etype (First_Entity (P));
Pred : Node_Id;
function May_Fold (N : Node_Id) return Traverse_Result;
-- The predicate expression is foldable if it only contains operators
......@@ -2491,13 +2489,21 @@ package body Exp_Ch6 is
-- value of the actual. This is done on a copy of the analyzed
-- expression for the predicate.
--------------
-- May_Fold --
--------------
function May_Fold (N : Node_Id) return Traverse_Result is
begin
case Nkind (N) is
when N_Binary_Op | N_Unary_Op =>
when N_Binary_Op
| N_Unary_Op
=>
return OK;
when N_Identifier | N_Expanded_Name =>
when N_Expanded_Name
| N_Identifier
=>
if Ekind (Entity (N)) = E_In_Parameter
and then Entity (N) = First_Entity (P)
then
......@@ -2512,7 +2518,9 @@ package body Exp_Ch6 is
return Abandon;
end if;
when N_If_Expression | N_Case_Expression =>
when N_Case_Expression
| N_If_Expression
=>
return OK;
when N_Integer_Literal =>
......@@ -2525,6 +2533,11 @@ package body Exp_Ch6 is
function Try_Fold is new Traverse_Func (May_Fold);
-- Local variables
Subt : constant Entity_Id := Etype (First_Entity (P));
Pred : Node_Id;
-- Start of processing for Can_Fold_Predicate_Call
begin
......@@ -2542,17 +2555,17 @@ package body Exp_Ch6 is
-- Retrieve the analyzed expression for the predicate
Pred :=
New_Copy_Tree
(Expression (Find_Aspect (Subt, Aspect_Dynamic_Predicate)));
New_Copy_Tree
(Expression (Find_Aspect (Subt, Aspect_Dynamic_Predicate)));
if Try_Fold (Pred) = OK then
Rewrite (Call_Node, Pred);
Analyze_And_Resolve (Call_Node, Standard_Boolean);
return True;
else
-- Continue expansion of function call
-- Otherwise continue the expansion of the function call
else
return False;
end if;
end Can_Fold_Predicate_Call;
......
......@@ -1056,9 +1056,10 @@ procedure Gnat1drv is
for U in Main_Unit .. Last_Unit loop
if In_Extended_Main_Source_Unit (Cunit_Entity (U)) then
declare
Nam : constant String :=
Get_Name_String (File_Name (Source_Index (U))) & ".json";
Namid : constant File_Name_Type := Name_Enter (Nam);
Nam : constant String :=
Get_Name_String
(File_Name (Source_Index (U))) & ".json";
Namid : constant File_Name_Type := Name_Enter (Nam);
Index : constant Source_File_Index := Load_Config_File (Namid);
begin
......
......@@ -1330,10 +1330,11 @@ package body Sem_Aux is
function Is_Protected_Operation (E : Entity_Id) return Boolean is
begin
return Is_Entry (E)
or else (Is_Subprogram (E)
and then Nkind (Parent (Unit_Declaration_Node (E))) =
N_Protected_Definition);
return
Is_Entry (E)
or else (Is_Subprogram (E)
and then Nkind (Parent (Unit_Declaration_Node (E))) =
N_Protected_Definition);
end Is_Protected_Operation;
----------------------
......
......@@ -31,7 +31,6 @@ with Restrict; use Restrict;
with Rident; use Rident;
with Sem_Ch8; use Sem_Ch8;
with Sem_Dim; use Sem_Dim;
-- with Sem_Util; use Sem_Util;
with Sinfo; use Sinfo;
with Stand; use Stand;
with Uintp; use Uintp;
......@@ -97,9 +96,7 @@ package body Sem_Ch2 is
-- prior analysis (or construction) of the literal, and after type
-- checking and resolution.
if No (Etype (N))
or else not Is_Modular_Integer_Type (Etype (N))
then
if No (Etype (N)) or else not Is_Modular_Integer_Type (Etype (N)) then
Set_Etype (N, Universal_Integer);
end if;
......
......@@ -815,8 +815,7 @@ package body Sem_Ch8 is
-- it does not apply to records with limited components, for which
-- this syntactic flag is not set, but whose size is also fixed.
elsif (Is_Record_Type (Typ)
and then Is_Limited_Type (Typ))
elsif (Is_Record_Type (Typ) and then Is_Limited_Type (Typ))
or else
(Ekind (Typ) = E_Limited_Private_Type
and then Has_Discriminants (Typ)
......
......@@ -3467,8 +3467,8 @@ package body Sem_Res is
or else Nkind (Original_Node (N)) not in N_Subprogram_Call
or else (Nkind (Name (N)) = N_Identifier
and then Present (Entity (Name (N)))
and then Nkind (Entity (Name (N)))
= N_Defining_Operator_Symbol)
and then Nkind (Entity (Name (N))) =
N_Defining_Operator_Symbol)
or else not Comes_From_Source (N)
then
return;
......
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