From 29c64a0f6d13bf413cf338da23580e8a94ead23c Mon Sep 17 00:00:00 2001 From: Hristian Kirtchev Date: Thu, 11 Jul 2019 08:02:03 +0000 Subject: [PATCH] [Ada] Minor reformatting 2019-07-11 Hristian Kirtchev 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 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/checks.adb | 18 +++++++++--------- gcc/ada/exp_ch6.adb | 31 ++++++++++++++++++++++--------- gcc/ada/gnat1drv.adb | 7 ++++--- gcc/ada/sem_aux.adb | 9 +++++---- gcc/ada/sem_ch2.adb | 5 +---- gcc/ada/sem_ch8.adb | 3 +-- gcc/ada/sem_res.adb | 4 ++-- 8 files changed, 49 insertions(+), 33 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index cc7178b..a17ab7e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,10 @@ 2019-07-11 Hristian Kirtchev + * 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 + * sem_ch8.adb (Analyze_Object_Renaming): Obtain the object being renamed using routine Get_Object_Name which takes care of various name forms. diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index 7ca66bd..984bb15 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -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; diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 0251d00..c23e9ee 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -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; diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb index 2e4204b..55a57dd 100644 --- a/gcc/ada/gnat1drv.adb +++ b/gcc/ada/gnat1drv.adb @@ -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 diff --git a/gcc/ada/sem_aux.adb b/gcc/ada/sem_aux.adb index 6a93a39..71a3873 100644 --- a/gcc/ada/sem_aux.adb +++ b/gcc/ada/sem_aux.adb @@ -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; ---------------------- diff --git a/gcc/ada/sem_ch2.adb b/gcc/ada/sem_ch2.adb index 0a282d4..378269f 100644 --- a/gcc/ada/sem_ch2.adb +++ b/gcc/ada/sem_ch2.adb @@ -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; diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 90b0c65..c9d6151 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -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) diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index c17b28d..730f173 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -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; -- 2.7.4