From c786216724918a454ed4634031f69efd275b963e Mon Sep 17 00:00:00 2001 From: Hristian Kirtchev Date: Wed, 14 Nov 2018 11:41:25 +0000 Subject: [PATCH] [Ada] Minor reformatting 2018-11-14 Hristian Kirtchev gcc/ada/ * back_end.adb, checks.adb, exp_ch3.adb, exp_ch4.adb, exp_ch7.adb, exp_disp.adb, exp_unst.adb, exp_util.adb, freeze.adb, sem_ch13.adb, sem_ch6.adb, sem_ch7.adb, sem_prag.adb, sem_spark.adb, sem_util.adb: Minor reformatting. From-SVN: r266122 --- gcc/ada/ChangeLog | 7 +++++++ gcc/ada/back_end.adb | 9 ++++---- gcc/ada/checks.adb | 4 ++-- gcc/ada/exp_ch3.adb | 22 +++++++++---------- gcc/ada/exp_ch4.adb | 10 ++++----- gcc/ada/exp_ch7.adb | 15 ++++++------- gcc/ada/exp_disp.adb | 9 ++++---- gcc/ada/exp_unst.adb | 49 ++++++++++++++++++++----------------------- gcc/ada/exp_util.adb | 6 +++--- gcc/ada/freeze.adb | 12 +++++------ gcc/ada/sem_ch13.adb | 32 ++++++++++++++-------------- gcc/ada/sem_ch6.adb | 10 ++++----- gcc/ada/sem_ch7.adb | 10 ++++----- gcc/ada/sem_prag.adb | 5 +++-- gcc/ada/sem_spark.adb | 1 - gcc/ada/sem_util.adb | 8 +++---- 16 files changed, 105 insertions(+), 104 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 2ebc0c9ecfd..c407793a0a6 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2018-11-14 Hristian Kirtchev + + * back_end.adb, checks.adb, exp_ch3.adb, exp_ch4.adb, + exp_ch7.adb, exp_disp.adb, exp_unst.adb, exp_util.adb, + freeze.adb, sem_ch13.adb, sem_ch6.adb, sem_ch7.adb, + sem_prag.adb, sem_spark.adb, sem_util.adb: Minor reformatting. + 2018-11-14 Hristian Kirtchev * exp_ch4.adb (Find_Aliased_Equality): New routine. diff --git a/gcc/ada/back_end.adb b/gcc/ada/back_end.adb index 61ab71879bb..e7798c845da 100644 --- a/gcc/ada/back_end.adb +++ b/gcc/ada/back_end.adb @@ -237,22 +237,21 @@ package body Back_End is Last : constant Natural := Switch_Last (Switch_Chars); begin - -- Skip -o or internal GCC switches together with their argument. + -- Skip -o or internal GCC switches together with their argument if Switch_Chars (First .. Last) = "o" or else Is_Internal_GCC_Switch (Switch_Chars) then Next_Arg := Next_Arg + 1; - -- Store -G xxx as -Gxxx and go directly to the next argument. + -- Store -G xxx as -Gxxx and go directly to the next argument elsif Switch_Chars (First .. Last) = "G" then Next_Arg := Next_Arg + 1; -- Should never get there with -G not followed by an argument, - -- but use defensive code nonetheless. - -- Store as -Gxxx to avoid storing parameters in ALI files that - -- might create confusion. + -- but use defensive code nonetheless. Store as -Gxxx to avoid + -- storing parameters in ALI files that might create confusion. if Next_Arg <= Args'Last then Store_Compilation_Switch (Switch_Chars & Args (Next_Arg).all); diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index e7048ecc4ef..6b9e6541f86 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -3552,8 +3552,8 @@ package body Checks is else -- Conversions involving fixed-point types are expanded -- separately, and do not need a Range_Check flag, except - -- in SPARK_Mode, where the explicit constraint check will - -- not be generated. + -- in GNATprove_Mode, where the explicit constraint check + -- will not be generated. if GNATprove_Mode or else not Is_Fixed_Point_Type (Expr_Type) diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index e116cda4442..1eddd61b992 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -8611,17 +8611,17 @@ package body Exp_Ch3 is ------------------ function Init_Formals (Typ : Entity_Id) return List_Id is - Unc_Arr : constant Boolean := - Is_Array_Type (Typ) and then not Is_Constrained (Typ); + Loc : constant Source_Ptr := Sloc (Typ); + Unc_Arr : constant Boolean := + Is_Array_Type (Typ) and then not Is_Constrained (Typ); With_Prot : constant Boolean := - Has_Protected (Typ) - or else (Is_Record_Type (Typ) - and then Is_Protected_Record_Type (Typ)); + Has_Protected (Typ) + or else (Is_Record_Type (Typ) + and then Is_Protected_Record_Type (Typ)); With_Task : constant Boolean := - Has_Task (Typ) - or else (Is_Record_Type (Typ) - and then Is_Task_Record_Type (Typ)); - Loc : constant Source_Ptr := Sloc (Typ); + Has_Task (Typ) + or else (Is_Record_Type (Typ) + and then Is_Task_Record_Type (Typ)); Formals : List_Id; begin @@ -9038,8 +9038,8 @@ package body Exp_Ch3 is Stmt : Node_Id; begin - -- We must skip SCIL nodes because they may have been added to the - -- list by Insert_Actions. + -- We must skip SCIL nodes because they may have been added to the list + -- by Insert_Actions. Stmt := First_Non_SCIL_Node (Stmts); while Present (Stmt) loop diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index c427b9e1e03..a00e0c7761d 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -4085,9 +4085,9 @@ package body Exp_Ch4 is Unchecked_Convert_To (Standard_Integer, Op_Expr)); else - -- If the modulus of the type is larger than Integer'Last - -- use a larger type for the operands, to prevent spurious - -- constraint errors on large legal literals of the type. + -- If the modulus of the type is larger than Integer'Last use a + -- larger type for the operands, to prevent spurious constraint + -- errors on large legal literals of the type. if Modulus (Etype (N)) > UI_From_Int (Int (Integer'Last)) then Target_Type := Standard_Long_Integer; @@ -11764,8 +11764,8 @@ package body Exp_Ch4 is elsif Is_Integer_Type (Etype (N)) then Expand_Convert_Fixed_To_Integer (N); - -- The result of the conversion might need a range check, - -- so do not assume that the result is in bounds. + -- The result of the conversion might need a range check, so do + -- not assume that the result is in bounds. Set_Etype (N, Base_Type (Target_Type)); diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index c579e627cb3..c8f39e7b4ee 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -362,10 +362,10 @@ package body Exp_Ch7 is procedure Check_Unnesting_In_Declarations (N : Node_Id); -- Similarly, the declarations in the package body may have created - -- blocks with nested subprograms. Such a block must be transformed - -- into a procedure followed by a call to it, so that unnesting can - -- handle uplevel references within these nested subprograms (typically - -- generated subprograms to handle finalization actions). + -- blocks with nested subprograms. Such a block must be transformed into a + -- procedure followed by a call to it, so that unnesting can handle uplevel + -- references within these nested subprograms (typically generated + -- subprograms to handle finalization actions). procedure Check_Visibly_Controlled (Prim : Final_Primitives; @@ -4177,16 +4177,16 @@ package body Exp_Ch7 is procedure Check_Unnesting_In_Declarations (N : Node_Id) is Decl : Node_Id; + Ent : Entity_Id; Inner_Decl : Node_Id; Loc : Source_Ptr; Local_Body : Node_Id; Local_Call : Node_Id; - - Ent : Entity_Id; Local_Proc : Entity_Id; begin Local_Call := Empty; + if Unnest_Subprogram_Mode and then Present (Declarations (N)) and then Is_Compilation_Unit (Current_Scope) @@ -4198,7 +4198,6 @@ package body Exp_Ch7 is Inner_Decl := First (Declarations (Decl)); while Present (Inner_Decl) loop - if Nkind (Inner_Decl) = N_Subprogram_Body then Loc := Sloc (Decl); Local_Proc := @@ -4213,6 +4212,7 @@ package body Exp_Ch7 is Declarations => Declarations (Decl), Handled_Statement_Sequence => Handled_Statement_Sequence (Decl)); + Rewrite (Decl, Local_Body); Analyze (Decl); Set_Has_Nested_Subprogram (Local_Proc); @@ -4220,6 +4220,7 @@ package body Exp_Ch7 is Local_Call := Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Local_Proc, Loc)); + Insert_After (Decl, Local_Call); Analyze (Local_Call); diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb index 79c08978071..f36cd1f8aed 100644 --- a/gcc/ada/exp_disp.adb +++ b/gcc/ada/exp_disp.adb @@ -1367,9 +1367,7 @@ package body Exp_Disp is -- to the object, because generic dispatching constructors are not -- supported. - if Opnd = Iface_Typ - and then not RTE_Available (RE_Displace) - then + if Opnd = Iface_Typ and then not RTE_Available (RE_Displace) then return; end if; end; @@ -2487,10 +2485,10 @@ package body Exp_Disp is (Typ : Entity_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (Typ); - Def_Id : constant Entity_Id := + B_Id : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uB); + Def_Id : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uDisp_Asynchronous_Select); - B_Id : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uB); Params : constant List_Id := New_List; begin @@ -2503,6 +2501,7 @@ package body Exp_Disp is -- F : out Boolean; -- Status flag -- The B parameter may be left uninitialized + Set_Warnings_Off (B_Id); Append_List_To (Params, New_List ( diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb index abcc6603c51..882866e38e0 100644 --- a/gcc/ada/exp_unst.adb +++ b/gcc/ada/exp_unst.adb @@ -752,14 +752,10 @@ package body Exp_Unst is procedure Register_Subprogram (E : Entity_Id; Bod : Node_Id) is L : constant Nat := Get_Level (Subp, E); - -- Subprograms declared in tasks and protected types cannot - -- be eliminated because calls to them may be in other units, - -- so they must be treated as reachable. - begin - -- Subprograms declared in tasks and protected types cannot - -- be eliminated because calls to them may be in other units, - -- so they must be treated as reachable. + -- Subprograms declared in tasks and protected types cannot be + -- eliminated because calls to them may be in other units, so + -- they must be treated as reachable. Subps.Append ((Ent => E, @@ -1154,9 +1150,9 @@ package body Exp_Unst is return Skip; end if; - -- Pragmas and component declarations can be ignored. - -- Quantified expressions are expanded into explicit loops - -- and the original epression must be ignored. + -- Pragmas and component declarations are ignored. Quantified + -- expressions are expanded into explicit loops and the + -- original epression must be ignored. when N_Component_Declaration | N_Pragma @@ -1389,10 +1385,10 @@ package body Exp_Unst is -- If this entity was marked reachable because it is -- in a task or protected type, there may not appear - -- to be any calls to it, which would normally - -- adjust the levels of the parent subprograms. - -- So we need to be sure that the uplevel reference - -- of that entity takes into account possible calls. + -- to be any calls to it, which would normally adjust + -- the levels of the parent subprograms. So we need to + -- be sure that the uplevel reference of that entity + -- takes into account possible calls. if In_Synchronized_Unit (SUBF.Ent) and then SUBT.Lev < SUBI.Uplevel_Ref @@ -1408,9 +1404,9 @@ package body Exp_Unst is -- We do not add types to this list, only actual references -- to objects that will be referenced uplevel, and we use -- the flag Is_Uplevel_Referenced_Entity to avoid making - -- duplicate entries in the list. - -- Discriminants are also excluded, only the enclosing - -- object can appear in the list. + -- duplicate entries in the list. Discriminants are also + -- excluded, only the enclosing object can appear in the + -- list. if not Is_Uplevel_Referenced_Entity (URJ.Ent) and then Ekind (URJ.Ent) /= E_Discriminant @@ -1750,8 +1746,8 @@ package body Exp_Unst is -- Declaration nodes for the AREC entities we build begin - -- Build list of component declarations for ARECnT - -- and load System.Address. + -- Build list of component declarations for ARECnT and + -- load System.Address. Clist := Empty_List; @@ -2009,10 +2005,11 @@ package body Exp_Unst is Attr := Name_Address; end if; - Rhs := Make_Attribute_Reference (Loc, - Prefix => - New_Occurrence_Of (Ent, Loc), - Attribute_Name => Attr); + Rhs := + Make_Attribute_Reference (Loc, + Prefix => + New_Occurrence_Of (Ent, Loc), + Attribute_Name => Attr); -- If the entity is an unconstrained formal -- we wrap the attribute reference in an @@ -2024,15 +2021,15 @@ package body Exp_Unst is if Is_Formal (Ent) and then not Is_Constrained (Etype (Ent)) then - -- Find target component and its type. + -- Find target component and its type Comp := First_Component (STJ.ARECnT); while Chars (Comp) /= Chars (Ent) loop Comp := Next_Component (Comp); end loop; - Rhs := Unchecked_Convert_To ( - Etype (Comp), Rhs); + Rhs := + Unchecked_Convert_To (Etype (Comp), Rhs); end if; Asn := diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 1ef342d318f..a76e92e7e44 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -9313,9 +9313,9 @@ package body Exp_Util is -- If the type is tagged, the expression may be class-wide, in which -- case it has to be converted to its root type, given that the - -- generated predicate function is not dispatching. The conversion - -- is type-safe and does not need validation, which matters when - -- private extensions are involved. + -- generated predicate function is not dispatching. The conversion is + -- type-safe and does not need validation, which matters when private + -- extensions are involved. if Is_Tagged_Type (Typ) then Call := diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 19b9ca9ecff..6734f6df544 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -8008,12 +8008,12 @@ package body Freeze is Set_Realval (Lo, Loval); end if; - -- Compute the fudged bounds. If the bound is a model number, - -- (or greater if given low bound, smaller if high bound) - -- then we do nothing to include it, but we are allowed to backoff - -- to the next adjacent model number when we exclude it. If it is - -- not a model number then we straddle the two values with the - -- model numbers on either side. + -- Compute the fudged bounds. If the bound is a model number, (or + -- greater if given low bound, smaller if high bound) then we do + -- nothing to include it, but we are allowed to backoff to the + -- next adjacent model number when we exclude it. If it is not a + -- model number then we straddle the two values with the model + -- numbers on either side. Model_Num := UR_Trunc (Loval / Small) * Small; diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index b999be63034..92d65e64ede 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -11449,6 +11449,20 @@ package body Sem_Ch13 is function Rep_Item_Entity (Rep_Item : Node_Id) return Entity_Id; -- Return the entity for which Rep_Item is specified + -------------------------------------------------- + -- Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item -- + -------------------------------------------------- + + function Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item + (Rep_Item : Node_Id) return Boolean + is + begin + return + Nkind (Rep_Item) = N_Pragma + or else Present_In_Rep_Item + (Entity (Rep_Item), Aspect_Rep_Item (Rep_Item)); + end Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item; + --------------------- -- Rep_Item_Entity -- --------------------- @@ -11460,26 +11474,12 @@ package body Sem_Ch13 is else pragma Assert (Nkind_In (Rep_Item, - N_Pragma, - N_Attribute_Definition_Clause)); + N_Attribute_Definition_Clause, + N_Pragma)); return Entity (Name (Rep_Item)); end if; end Rep_Item_Entity; - -------------------------------------------------- - -- Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item -- - -------------------------------------------------- - - function Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item - (Rep_Item : Node_Id) return Boolean - is - begin - return - Nkind (Rep_Item) = N_Pragma - or else Present_In_Rep_Item - (Entity (Rep_Item), Aspect_Rep_Item (Rep_Item)); - end Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item; - -- Start of processing for Inherit_Aspects_At_Freeze_Point begin diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 166987ad016..f7b688045ea 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -8925,9 +8925,9 @@ package body Sem_Ch6 is and then Discriminal_Link (Entity (E1)) = Discriminal_Link (Entity (E2))) - -- AI12-050: The loop variables of quantified expressions - -- match if they have the same identifier, even though they - -- are different entities. + -- AI12-050: The loop variables of quantified expressions match + -- if they have the same identifier, even though they may have + -- different entities. or else (Chars (Entity (E1)) = Chars (Entity (E2)) @@ -8935,8 +8935,8 @@ package body Sem_Ch6 is and then Ekind (Entity (E2)) = E_Loop_Parameter) -- A call to an instantiation of Unchecked_Conversion is - -- rewritten with the name of the generated function - -- created for the instance, and this must be special-cased. + -- rewritten with the name of the generated function created for + -- the instance, and this must be special-cased. or else (Ekind (Entity (E1)) = E_Function diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb index 1c732b4281b..28119dfd121 100644 --- a/gcc/ada/sem_ch7.adb +++ b/gcc/ada/sem_ch7.adb @@ -2855,13 +2855,13 @@ package body Sem_Ch7 is Set_Is_Potentially_Use_Visible (Id); end if; - -- We need to avoid incorrectly marking enumeration literals - -- as non-visible when a visible use-all-type clause is in effect. + -- We need to avoid incorrectly marking enumeration literals as + -- non-visible when a visible use-all-type clause is in effect. elsif Type_In_Use (Etype (Id)) - and then Nkind (Current_Use_Clause (Etype (Id))) = - N_Use_Type_Clause - and then All_Present (Current_Use_Clause (Etype (Id))) + and then Nkind (Current_Use_Clause (Etype (Id))) = + N_Use_Type_Clause + and then All_Present (Current_Use_Clause (Etype (Id))) then null; diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 2293f73cbd5..a96d148ecbb 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -27743,8 +27743,9 @@ package body Sem_Prag is else pragma Assert (Present (Global)); Error_Msg_Sloc := Sloc (Global); - SPARK_Msg_NE ("extra global item & does not refine or " & - "repeat any global item #", Item, Item_Id); + SPARK_Msg_NE + ("extra global item & does not refine or repeat any " + & "global item #", Item, Item_Id); end if; end if; end Check_Refined_Global_Item; diff --git a/gcc/ada/sem_spark.adb b/gcc/ada/sem_spark.adb index 0fe7c1b881c..b8baeeb209f 100644 --- a/gcc/ada/sem_spark.adb +++ b/gcc/ada/sem_spark.adb @@ -863,7 +863,6 @@ package body Sem_SPARK is ----------------------- procedure Check_Declaration (Decl : Node_Id) is - Target_Ent : constant Entity_Id := Defining_Identifier (Decl); Target_Typ : Node_Id renames Etype (Target_Ent); diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 58669dd3937..e3d7718a599 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -8593,9 +8593,7 @@ package body Sem_Util is -- Single global item declaration (only input items) - elsif Nkind_In (List, N_Expanded_Name, - N_Identifier) - then + elsif Nkind_In (List, N_Expanded_Name, N_Identifier) then if Global_Mode = Name_Input then return List; else @@ -8647,9 +8645,9 @@ package body Sem_Util is Body_Id : Entity_Id; begin - pragma Assert (Nam_In (Global_Mode, Name_Input, + pragma Assert (Nam_In (Global_Mode, Name_In_Out, + Name_Input, Name_Output, - Name_In_Out, Name_Proof_In)); -- Retrieve the suitable pragma Global or Refined_Global. In the second -- 2.30.2