From 0c506265dd18ed7669eac58c027320b5c16b2b6e Mon Sep 17 00:00:00 2001 From: Hristian Kirtchev Date: Wed, 30 May 2018 08:58:05 +0000 Subject: [PATCH] [Ada] Minor reformatting 2018-05-30 Hristian Kirtchev gcc/ada/ * checks.adb, exp_ch5.adb, exp_ch7.adb, exp_unst.adb, sem_eval.adb: Minor reformatting. From-SVN: r260941 --- gcc/ada/ChangeLog | 5 ++++ gcc/ada/checks.adb | 1 + gcc/ada/exp_ch5.adb | 1 + gcc/ada/exp_ch7.adb | 45 ++++++++++++++++++--------------- gcc/ada/exp_unst.adb | 59 ++++++++++++++++++++++++-------------------- gcc/ada/sem_eval.adb | 1 + 6 files changed, 65 insertions(+), 47 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 80abf0ccd4c..d7d48ecf495 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2018-05-30 Hristian Kirtchev + + * checks.adb, exp_ch5.adb, exp_ch7.adb, exp_unst.adb, sem_eval.adb: + Minor reformatting. + 2018-05-30 Pascal Obry * libgnat/g-comlin.ads (Value_Callback, Define_Switch): New. diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index 8fc81e9e840..584e74734bc 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -3065,6 +3065,7 @@ package body Checks is -- If definitely not in range, warn elsif Lov > Hi or else Hiv < Lo then + -- Ignore out of range values for System.Priority in -- CodePeer mode since the actual target compiler may -- provide a wider range. diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb index cf1b5c55d39..e0cff915bca 100644 --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -3286,6 +3286,7 @@ package body Exp_Ch5 is Parameter_Associations => New_List ( Convert_To_Iterable_Type (Container, Loc), New_Occurrence_Of (Cursor, Loc)))); + Set_Statements (New_Loop, New_List (Make_Block_Statement (Loc, diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index 37d12906bed..8f510c60420 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -3969,8 +3969,8 @@ package body Exp_Ch7 is begin -- For restricted run-time libraries (Ravenscar), tasks are - -- non-terminating and they can only appear at library level, so we do - -- not want finalization of task objects. + -- non-terminating and they can only appear at library level, + -- so we do not want finalization of task objects. if Restricted_Profile then return Empty; @@ -4014,37 +4014,42 @@ package body Exp_Ch7 is Make_Defining_Identifier (Loc, Chars => New_Internal_Name ('I')); - Elab_Body := Make_Subprogram_Body (Loc, - Specification => - Make_Procedure_Specification (Loc, - Defining_Unit_Name => Elab_Proc), - Declarations => New_List, - Handled_Statement_Sequence => - Relocate_Node (Handled_Statement_Sequence (N))); + Elab_Body := + Make_Subprogram_Body (Loc, + Specification => + Make_Procedure_Specification (Loc, + Defining_Unit_Name => Elab_Proc), + Declarations => New_List, + Handled_Statement_Sequence => + Relocate_Node (Handled_Statement_Sequence (N))); + + Elab_Call := + Make_Procedure_Call_Statement (Loc, + Name => New_Occurrence_Of (Elab_Proc, Loc)); - Elab_Call := Make_Procedure_Call_Statement (Loc, - New_Occurrence_Of (Elab_Proc, Loc)); Append_To (Declarations (N), Elab_Body); Analyze (Elab_Body); Set_Has_Nested_Subprogram (Elab_Proc); Set_Handled_Statement_Sequence (N, - Make_Handled_Sequence_Of_Statements (Loc, - Statements => New_List (Elab_Call))); + Make_Handled_Sequence_Of_Statements (Loc, + Statements => New_List (Elab_Call))); + Analyze (Elab_Call); - -- The scope of all blocks in the elaboration code is - -- now the constructed elaboration procedure. Nested - -- subprograms within those blocks will have activation - -- records if they contain references to entities in the - -- enclosing block. + -- The scope of all blocks in the elaboration code is now the + -- constructed elaboration procedure. Nested subprograms within + -- those blocks will have activation records if they contain + -- references to entities in the enclosing block. + + Stat := + First (Statements (Handled_Statement_Sequence (Elab_Body))); - Stat := First - (Statements (Handled_Statement_Sequence (Elab_Body))); while Present (Stat) loop if Nkind (Stat) = N_Block_Statement then Set_Scope (Entity (Identifier (Stat)), Elab_Proc); end if; + Next (Stat); end loop; end if; diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb index 98f6dffc9f2..b394f21cee8 100644 --- a/gcc/ada/exp_unst.adb +++ b/gcc/ada/exp_unst.adb @@ -619,6 +619,7 @@ package body Exp_Unst is procedure Register_Subprogram (E : Entity_Id; Bod : Node_Id) is L : constant Nat := Get_Level (Subp, E); + begin Subps.Append ((Ent => E, @@ -635,6 +636,7 @@ package body Exp_Unst is ARECnPT => Empty, ARECnP => Empty, ARECnU => Empty)); + Set_Subps_Index (E, UI_From_Int (Subps.Last)); end Register_Subprogram; @@ -645,10 +647,12 @@ package body Exp_Unst is -- Record a subprogram call - when N_Procedure_Call_Statement | N_Function_Call => + when N_Function_Call + | N_Procedure_Call_Statement + => -- We are only interested in direct calls, not indirect - -- calls (where Name (N) is an explicit dereference). - -- at least for now! + -- calls (where Name (N) is an explicit dereference) at + -- least for now! if Nkind (Name (N)) in N_Has_Entity then Ent := Entity (Name (N)); @@ -670,10 +674,10 @@ package body Exp_Unst is -- for uplevel references. declare - Subp : Entity_Id; Actual : Entity_Id; - Formal : Node_Id; DT : Boolean := False; + Formal : Node_Id; + Subp : Entity_Id; begin if Nkind (Name (N)) = N_Explicit_Dereference then @@ -697,18 +701,18 @@ package body Exp_Unst is end loop; end; - -- An At_End_Proc in a statement sequence indicates that - -- there's a call from the enclosing construct or block - -- to that subprogram. As above, the called entity must - -- be local and not imported. + -- An At_End_Proc in a statement sequence indicates that there + -- is a call from the enclosing construct or block to that + -- subprogram. As above, the called entity must be local and + -- not imported. when N_Handled_Sequence_Of_Statements => if Present (At_End_Proc (N)) and then Scope_Within (Entity (At_End_Proc (N)), Subp) and then not Is_Imported (Entity (At_End_Proc (N))) then - Append_Unique_Call ((N, Current_Subprogram, - Entity (At_End_Proc (N)))); + Append_Unique_Call + ((N, Current_Subprogram, Entity (At_End_Proc (N)))); end if; -- A 'Access reference is a (potential) call. @@ -759,8 +763,8 @@ package body Exp_Unst is declare DT : Boolean := False; begin - Check_Static_Type (Etype (Prefix (N)), - Empty, DT); + Check_Static_Type + (Etype (Prefix (N)), Empty, DT); end; return OK; @@ -818,6 +822,7 @@ package body Exp_Unst is end if; -- Make new entry in subprogram table if not already made + Register_Subprogram (Ent, N); -- We make a recursive call to scan the subprogram body, so @@ -852,8 +857,8 @@ package body Exp_Unst is return Skip; - -- If we have a body stub, visit the associated subunit, - -- which is a semantic descendant of the stub. + -- If we have a body stub, visit the associated subunit, which + -- is a semantic descendant of the stub. when N_Body_Stub => Visit (Library_Unit (N)); @@ -885,8 +890,8 @@ package body Exp_Unst is -- Otherwise record an uplevel reference when others => - if - Nkind (N) in N_Has_Entity and then Present (Entity (N)) + if Nkind (N) in N_Has_Entity + and then Present (Entity (N)) then Ent := Entity (N); @@ -900,14 +905,14 @@ package body Exp_Unst is and then Chars (Enclosing_Subprogram (Ent)) /= Name_uParent - -- Constants and variables are potentially - -- uplevel references to global declarations. + -- Constants and variables are potentially uplevel + -- references to global declarations. and then (Ekind_In (Ent, E_Constant, E_Variable) - -- Formals are interesting, but not if being used as mere - -- names of parameters for name notation calls. + -- Formals are interesting, but not if being used as + -- mere names of parameters for name notation calls. or else (Is_Formal (Ent) @@ -916,7 +921,7 @@ package body Exp_Unst is and then Selector_Name (Parent (N)) = N)) -- Types other than known Is_Static types are - -- potentially interesting + -- potentially interesting. or else (Is_Type (Ent) and then not Is_Static_Type (Ent))) @@ -2037,13 +2042,13 @@ package body Exp_Unst is return; end if; - -- A specification will contain bodies if it contains instantiations - -- so examine package or subprogram declaration of the main unit, - -- when it is present. + -- A specification will contain bodies if it contains instantiations so + -- examine package or subprogram declaration of the main unit, when it + -- is present. if Nkind (Unit (N)) = N_Package_Body - or else (Nkind (Unit (N)) = N_Subprogram_Body - and then not Acts_As_Spec (N)) + or else (Nkind (Unit (N)) = N_Subprogram_Body + and then not Acts_As_Spec (N)) then Do_Search (Library_Unit (N)); end if; diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index b216dabb19d..59e867256ea 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -574,6 +574,7 @@ package body Sem_Eval is null; elsif Is_Out_Of_Range (N, T, Assume_Valid => True) then + -- Ignore out of range values for System.Priority in CodePeer -- mode since the actual target compiler may provide a wider -- range. -- 2.30.2