From 14e75608240f1df215e003c08b8fdbe4a6a9844c Mon Sep 17 00:00:00 2001 From: Gary Dismukes Date: Tue, 14 Apr 2020 14:13:47 -0400 Subject: [PATCH] [Ada] Various typo corrections plus minor reformatting 2020-06-17 Gary Dismukes gcc/ada/ * exp_ch3.ads (Build_Access_Subprogram_Wrapper_Body): Adjust colon columns; reformat comment. * exp_ch3.adb (Build_Access_Subprogram_Wrapper_Body): Likewise. * sem_ch3.adb (Build_Access_Subprogram_Wrapper): Reformat spec comment and reformat comment in body. (Analyze_Full_Type_Declaration): Reformat comment. (Replace_Type_Name): Fixed three typos, plus reformatting of comment. * sem_prag.adb (Analyze_Pre_Post_Condition): Fix typos. * sem_warn.adb (Warn_On_Overlapping_Actuals): Edit comments: remove hyphen, add missing word. --- gcc/ada/exp_ch3.adb | 17 +++++++++-------- gcc/ada/exp_ch3.ads | 15 +++++++-------- gcc/ada/sem_ch3.adb | 28 +++++++++++++--------------- gcc/ada/sem_prag.adb | 4 ++-- gcc/ada/sem_warn.adb | 4 ++-- 5 files changed, 33 insertions(+), 35 deletions(-) diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 6e1e6251d10..15b88c3a87b 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -520,20 +520,21 @@ package body Exp_Ch3 is ------------------------------------------ procedure Build_Access_Subprogram_Wrapper_Body - (Decl : Node_Id; + (Decl : Node_Id; New_Decl : Node_Id) is Loc : constant Source_Ptr := Sloc (Decl); - Actuals : constant List_Id := New_List; - Type_Def : constant Node_Id := Type_Definition (Decl); - Type_Id : constant Entity_Id := Defining_Identifier (Decl); - Spec_Node : constant Node_Id := - New_Copy_Tree (Specification (New_Decl)); + Actuals : constant List_Id := New_List; + Type_Def : constant Node_Id := Type_Definition (Decl); + Type_Id : constant Entity_Id := Defining_Identifier (Decl); + Spec_Node : constant Node_Id := + New_Copy_Tree (Specification (New_Decl)); Act : Node_Id; Body_Node : Node_Id; Call_Stmt : Node_Id; Ptr : Entity_Id; + begin if not Expander_Active then return; @@ -543,8 +544,8 @@ package body Exp_Ch3 is Make_Defining_Identifier (Loc, Chars (Defining_Unit_Name (Spec_Node)))); - -- Create List of actuals for indirect call. The last - -- parameter of the subprogram is the access value itself. + -- Create List of actuals for indirect call. The last parameter of the + -- subprogram is the access value itself. Act := First (Parameter_Specifications (Spec_Node)); diff --git a/gcc/ada/exp_ch3.ads b/gcc/ada/exp_ch3.ads index 12387cfcca4..fcbe83befaa 100644 --- a/gcc/ada/exp_ch3.ads +++ b/gcc/ada/exp_ch3.ads @@ -47,15 +47,14 @@ package Exp_Ch3 is -- Add a field _parent in the extension part of the record procedure Build_Access_Subprogram_Wrapper_Body - (Decl : Node_Id; + (Decl : Node_Id; New_Decl : Node_Id); - -- Build the wrapper body, which holds the indirect call through - -- an access_to_subprogram, and whose expansion incorporates the - -- contracts of the access type declaration. Called from Build_ - -- Access_Subprogram_Wrapper. - -- Building the wrapper is done during analysis to perform proper - -- semantic checks on the relevant aspects. The wrapper body could - -- be simplified to a null body when expansion is disabled ??? + -- Build the wrapper body, which holds the indirect call through an access- + -- to-subprogram, and whose expansion incorporates the contracts of the + -- access type declaration. Called from Build_Access_Subprogram_Wrapper. + -- Building the wrapper is done during analysis to perform proper semantic + -- checks on the relevant aspects. The wrapper body could be simplified to + -- a null body when expansion is disabled ??? procedure Build_Discr_Checking_Funcs (N : Node_Id); -- Builds function which checks whether the component name is consistent diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 2e97516cd3e..63d0c6ddd39 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -93,9 +93,9 @@ package body Sem_Ch3 is -- record type. procedure Build_Access_Subprogram_Wrapper (Decl : Node_Id); - -- When an access_to_subprogram type has pre/postconditions, we - -- build a subprogram that includes these contracts and is invoked - -- by any indirect call through the corresponding access type. + -- When an access-to-subprogram type has pre/postconditions, we build a + -- subprogram that includes these contracts and is invoked by an indirect + -- call through the corresponding access type. procedure Build_Derived_Type (N : Node_Id; @@ -3142,9 +3142,9 @@ package body Sem_Ch3 is Validate_Access_Type_Declaration (T, N); -- If the type has contracts, we create the corresponding - -- wrapper at once, before analyzing the aspect - -- specifications, so that pre/postconditions can be - -- handled directly on the generated wrapper. + -- wrapper at once, before analyzing the aspect specifications, + -- so that pre/postconditions can be handled directly on the + -- generated wrapper. if Ada_Version >= Ada_2020 and then Present (Aspect_Specifications (N)) @@ -6483,13 +6483,11 @@ package body Sem_Ch3 is Spec : Node_Id; procedure Replace_Type_Name (Expr : Node_Id); - -- In the expressions for contract aspects, replace - -- occurrences of the access type with the name of the - -- subprogram entity, as needed, e.g. for 'Result. - -- Apects that are not contracts 9e.g. Size or Aligment) - -- remain on the originsl access type declaration. - -- What about expanded names denoting formals, whose prefix - -- in the source is the type name ??? + -- In the expressions for contract aspects, replace occurrences of the + -- access type with the name of the subprogram entity, as needed, e.g. + -- for 'Result. Aspects that are not contracts, e.g. Size or Alignment) + -- remain on the original access type declaration. What about expanded + -- names denoting formals, whose prefix in source is the type name ??? ----------------------- -- Replace_Type_Name -- @@ -6570,8 +6568,8 @@ package body Sem_Ch3 is Next (Form_P); end loop; - -- Add to parameter specifications the access parameter that - -- is passed in from an indirect call. + -- Add to parameter specifications the access parameter that is passed + -- in from an indirect call. Append ( Make_Parameter_Specification (Loc, diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 9e7f4c89d8c..740e3eaa234 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -4774,8 +4774,8 @@ package body Sem_Prag is then null; - -- Access_To_Subprogram type can have pre/postconditions, but - -- these are trasnfered to the generated subprogram wrapper and + -- An access-to-subprogram type can have pre/postconditions, but + -- these are transferred to the generated subprogram wrapper and -- analyzed there. -- Otherwise the placement of the pragma is illegal diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index 1ca5d5aa841..5e9c6164131 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -3698,14 +3698,14 @@ package body Sem_Warn is -- out to C that is known to denote the same object (RM 6.4.1(6.15/3)) -- This has been clarified in AI12-0216 to indicate that the illegality -- only occurs if both formals are of an elementary type, because of the - -- non-determinism on the write-back of the corresponding actuals. + -- nondeterminism on the write-back of the corresponding actuals. -- Earlier versions of the language made it illegal if only one of the -- actuals was an elementary parameter that overlapped a composite -- actual, and both were writable. -- If appropriate warning switch is set, we also report warnings on -- overlapping parameters that are composite types. Users find these - -- warnings useful, and they used in style guides. + -- warnings useful, and they are used in style guides. -- It is also worthwhile to warn on overlaps of composite objects when -- only one of the formals is (in)-out. Note that the RM rule above is -- 2.30.2