From 89beb6536755b02c83289fedd6182b79565a08fb Mon Sep 17 00:00:00 2001 From: Hristian Kirtchev Date: Mon, 3 Dec 2018 15:48:34 +0000 Subject: [PATCH] [Ada] Minor reformattings 2018-12-03 Hristian Kirtchev gcc/ada/ * checks.adb, exp_aggr.adb, exp_attr.adb, exp_ch3.adb, exp_util.adb, exp_util.ads, repinfo.adb, sem_attr.adb, sem_ch3.adb, sem_res.adb, sem_util.adb: Minor reformatting. From-SVN: r266750 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/checks.adb | 1 - gcc/ada/exp_aggr.adb | 2 +- gcc/ada/exp_attr.adb | 23 ++++++++++++++--------- gcc/ada/exp_ch3.adb | 8 ++++---- gcc/ada/exp_util.adb | 11 +++++++---- gcc/ada/exp_util.ads | 4 +++- gcc/ada/repinfo.adb | 6 +++--- gcc/ada/sem_attr.adb | 4 ++-- gcc/ada/sem_ch3.adb | 12 ++++-------- gcc/ada/sem_res.adb | 43 ++++++++++++++++++++++++------------------- gcc/ada/sem_util.adb | 1 - 12 files changed, 68 insertions(+), 53 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 4a4fee49ad1..5397c76502c 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2018-12-03 Hristian Kirtchev + + * checks.adb, exp_aggr.adb, exp_attr.adb, exp_ch3.adb, + exp_util.adb, exp_util.ads, repinfo.adb, sem_attr.adb, + sem_ch3.adb, sem_res.adb, sem_util.adb: Minor reformatting. + 2018-12-03 Ed Schonberg * sem_ch3.adb (Complete_Private_Subtype): Enhance comment. diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index 89f26fa0770..8db6b0f8430 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -4574,7 +4574,6 @@ package body Checks is Typ := Actual_Subtype (Entity (N)); end if; - null; else Typ := Underlying_Type (Base_Type (Typ)); end if; diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 2eff7512c76..866abed3920 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -4541,7 +4541,7 @@ package body Exp_Aggr is declare P : constant Entity_Id := - Cunit_Entity (Current_Sem_Unit); + Cunit_Entity (Current_Sem_Unit); begin -- Check if duplication is always OK and, if so, diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb index 2c2442a3bc8..67dd9416983 100644 --- a/gcc/ada/exp_attr.adb +++ b/gcc/ada/exp_attr.adb @@ -6610,15 +6610,20 @@ package body Exp_Attr is -- also needs to be static, because we do some legality checks (e.g. -- for Thread_Local_Storage) after this transformation. - when Attribute_Ref | Attribute_To_Address => To_Address : declare - Is_Static : constant Boolean := Is_Static_Expression (N); - begin - Rewrite (N, - Unchecked_Convert_To (RTE (RE_Address), - Relocate_Node (First (Exprs)))); - Set_Is_Static_Expression (N, Is_Static); - Analyze_And_Resolve (N, RTE (RE_Address)); - end To_Address; + when Attribute_Ref + | Attribute_To_Address + => + To_Address : declare + Is_Static : constant Boolean := Is_Static_Expression (N); + + begin + Rewrite (N, + Unchecked_Convert_To (RTE (RE_Address), + Relocate_Node (First (Exprs)))); + Set_Is_Static_Expression (N, Is_Static); + + Analyze_And_Resolve (N, RTE (RE_Address)); + end To_Address; ------------ -- To_Any -- diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 64cded5c0a1..65f6805bb7c 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -6587,10 +6587,10 @@ package body Exp_Ch3 is if Is_Delayed_Aggregate (Expr_Q) then - -- An aggregate that must be built in place is not resolved - -- and expanded until the enclosing construct is expanded. - -- This will happen when the aggregqte is limited and the - -- declared object has a following address clause. + -- An aggregate that must be built in place is not resolved and + -- expanded until the enclosing construct is expanded. This will + -- happen when the aggregqte is limited and the declared object + -- has a following address clause. if Is_Limited_Type (Typ) and then not Analyzed (Expr) then Resolve (Expr, Typ); diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index b5338d4deb2..9fcf10cf5a1 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -13414,7 +13414,10 @@ package body Exp_Util is -- See also Silly_Boolean_Array_Not_Test procedure Silly_Boolean_Array_Xor_Test - (N : Node_Id; R : Node_Id; T : Entity_Id) is + (N : Node_Id; + R : Node_Id; + T : Entity_Id) + is Loc : constant Source_Ptr := Sloc (N); CT : constant Entity_Id := Component_Type (T); @@ -13435,9 +13438,9 @@ package body Exp_Util is Make_Raise_Constraint_Error (Loc, Condition => Make_And_Then (Loc, - Left_Opnd => + Left_Opnd => Make_And_Then (Loc, - Left_Opnd => + Left_Opnd => Convert_To (Standard_Boolean, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (CT, Loc), @@ -13450,7 +13453,7 @@ package body Exp_Util is Attribute_Name => Name_Last))), Right_Opnd => Make_Non_Empty_Check (Loc, R)), - Reason => CE_Range_Check_Failed)); + Reason => CE_Range_Check_Failed)); end Silly_Boolean_Array_Xor_Test; -------------------------- diff --git a/gcc/ada/exp_util.ads b/gcc/ada/exp_util.ads index 9b76ef88a2d..ab48b743dc0 100644 --- a/gcc/ada/exp_util.ads +++ b/gcc/ada/exp_util.ads @@ -1141,7 +1141,9 @@ package Exp_Util is -- that a Constraint_Error exception be raised (RM 4.5.6(6)). procedure Silly_Boolean_Array_Xor_Test - (N : Node_Id; R : Node_Id; T : Entity_Id); + (N : Node_Id; + R : Node_Id; + T : Entity_Id); -- N is the node for a boolean array XOR operation, T is the type of the -- array, and R is a copy of the right operand of N, required to prevent -- scope anomalies when unnesting is in effect. This routine deals with diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb index d0d46fcde4f..3b41f935863 100644 --- a/gcc/ada/repinfo.adb +++ b/gcc/ada/repinfo.adb @@ -120,9 +120,9 @@ package body Repinfo is -- the current entity. Set True when a new entity is processed, and false -- when the blank line is output. - ------------------------------- - -- Set of Relevant Entities -- - ------------------------------- + ------------------------------ + -- Set of Relevant Entities -- + ------------------------------ Relevant_Entities_Size : constant := 4093; -- Number of headers in hash table diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 30cdc95eb65..a9f9f93ed22 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -8284,7 +8284,7 @@ package body Sem_Attr is Analyze_And_Resolve (N, Standard_Boolean); Static := True; - Set_Is_Static_Expression (N, True); + Set_Is_Static_Expression (N); end Atomic_Always_Lock_Free; --------- @@ -8737,7 +8737,7 @@ package body Sem_Attr is Analyze_And_Resolve (N, Standard_Boolean); Static := True; - Set_Is_Static_Expression (N, True); + Set_Is_Static_Expression (N); end Lock_Free; ---------- diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 25d4000ebfd..d99370ae6bb 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -4278,21 +4278,19 @@ package body Sem_Ch3 is and then Nkind (E) = N_Aggregate and then ((Present (Following_Address_Clause (N)) - and then not Ignore_Rep_Clauses) + and then not Ignore_Rep_Clauses) or else Delayed_Aspect_Present) then Set_Etype (E, T); - -- If the aggregate is limited it will be built in place, - -- and its expansion is deferred until the object declaration - -- is expanded. + -- If the aggregate is limited it will be built in place, and its + -- expansion is deferred until the object declaration is expanded. if Is_Limited_Type (T) then Set_Expansion_Delayed (E); end if; else - -- If the expression is a formal that is a "subprogram pointer" -- this is illegal in accessibility terms (see RM 3.10.2 (13.1/2) -- and AARM 3.10.2 (13.b/2)). Add an explicit conversion to force @@ -4365,9 +4363,7 @@ package body Sem_Ch3 is Set_Current_Value (Id, E); end if; - elsif Is_Scalar_Type (T) - and then Is_OK_Static_Expression (E) - then + elsif Is_Scalar_Type (T) and then Is_OK_Static_Expression (E) then Set_Is_Known_Valid (Id); -- If it is a constant initialized with a valid nonstatic entity, diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index b15be8e847b..ad0b5a06abc 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -8457,39 +8457,44 @@ package body Sem_Res is --------------------------- procedure Resolve_If_Expression (N : Node_Id; Typ : Entity_Id) is - Condition : constant Node_Id := First (Expressions (N)); - Then_Expr : Node_Id; - Else_Expr : Node_Id; - procedure Apply_Check (Expr : Node_Id); - -- When a dependent expression is of a subtype different from the - -- context subtype, then insert a qualification to ensure the - -- generation of a constraint check. This was previously done only - -- for scalar types. + -- When a dependent expression is of a subtype different from + -- the context subtype, then insert a qualification to ensure + -- the generation of a constraint check. This was previously + -- done only for scalar types. ----------------- -- Apply_Check -- ----------------- procedure Apply_Check (Expr : Node_Id) is - Loc : constant Source_Ptr := Sloc (Expr); - Expr_Type : constant Entity_Id := Etype (Expr); - begin + Expr_Typ : constant Entity_Id := Etype (Expr); + Loc : constant Source_Ptr := Sloc (Expr); - if Expr_Type /= Typ - and then not Is_Tagged_Type (Typ) - and then not Is_Access_Type (Typ) - and then Is_Constrained (Typ) - and then not Inside_A_Generic + begin + if Expr_Typ /= Typ + and then not Is_Tagged_Type (Typ) + and then not Is_Access_Type (Typ) + and then Is_Constrained (Typ) + and then not Inside_A_Generic then Rewrite (Expr, - Make_Qualified_Expression (Loc, - Subtype_Mark => New_Occurrence_Of (Typ, Loc), - Expression => Relocate_Node (Expr))); + Make_Qualified_Expression (Loc, + Subtype_Mark => New_Occurrence_Of (Typ, Loc), + Expression => Relocate_Node (Expr))); + Analyze_And_Resolve (Expr, Typ); end if; end Apply_Check; + -- Local variables + + Condition : constant Node_Id := First (Expressions (N)); + Else_Expr : Node_Id; + Then_Expr : Node_Id; + + -- Start of processing for Resolve_If_Expression + begin -- Defend against malformed expressions diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index e3d7718a599..1d34d2ae76c 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -14160,7 +14160,6 @@ package body Sem_Util is -- Check for prefix being an aliased component??? null; - end if; -- A heap object is constrained by its initial value -- 2.30.2