From 812e6118dcab9e0b0e717c44a987ce65ec7c13ec Mon Sep 17 00:00:00 2001 From: Bob Duff Date: Wed, 30 May 2018 08:57:44 +0000 Subject: [PATCH] [Ada] Spell preanalysis, preanalyze correctly 2018-05-30 Bob Duff gcc/ada/ * aspects.ads, contracts.adb, exp_util.adb, expander.adb, expander.ads, freeze.adb, inline.adb, lib-xref.adb, sem.ads, sem_aggr.adb, sem_attr.adb, sem_ch13.adb, sem_ch3.adb, sem_ch5.adb, sem_ch6.adb, sem_ch8.adb, sem_dim.adb, sem_elab.adb, sem_res.adb, sem_res.ads, sinfo.ads: Spell preanalysis, preanalyze correctly. From-SVN: r260937 --- gcc/ada/ChangeLog | 8 ++++++++ gcc/ada/aspects.ads | 2 +- gcc/ada/contracts.adb | 2 +- gcc/ada/exp_util.adb | 2 +- gcc/ada/expander.adb | 4 ++-- gcc/ada/expander.ads | 6 +++--- gcc/ada/freeze.adb | 2 +- gcc/ada/inline.adb | 2 +- gcc/ada/lib-xref.adb | 2 +- gcc/ada/sem.ads | 18 +++++++++--------- gcc/ada/sem_aggr.adb | 2 +- gcc/ada/sem_attr.adb | 2 +- gcc/ada/sem_ch13.adb | 4 ++-- gcc/ada/sem_ch3.adb | 4 ++-- gcc/ada/sem_ch5.adb | 6 +++--- gcc/ada/sem_ch6.adb | 4 ++-- gcc/ada/sem_ch8.adb | 2 +- gcc/ada/sem_dim.adb | 2 +- gcc/ada/sem_elab.adb | 2 +- gcc/ada/sem_res.adb | 2 +- gcc/ada/sem_res.ads | 4 ++-- gcc/ada/sinfo.ads | 2 +- 22 files changed, 46 insertions(+), 38 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 330a11e7ab6..1e1056b6fd9 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2018-05-30 Bob Duff + + * aspects.ads, contracts.adb, exp_util.adb, expander.adb, expander.ads, + freeze.adb, inline.adb, lib-xref.adb, sem.ads, sem_aggr.adb, + sem_attr.adb, sem_ch13.adb, sem_ch3.adb, sem_ch5.adb, sem_ch6.adb, + sem_ch8.adb, sem_dim.adb, sem_elab.adb, sem_res.adb, sem_res.ads, + sinfo.ads: Spell preanalysis, preanalyze correctly. + 2018-05-30 Bob Duff * libgnat/g-sestin.ads: Rework documentation comments. diff --git a/gcc/ada/aspects.ads b/gcc/ada/aspects.ads index 02439aa46c9..16dcab8c9ef 100644 --- a/gcc/ada/aspects.ads +++ b/gcc/ada/aspects.ads @@ -59,7 +59,7 @@ -- 5. If the semantic analysis of expressions/names in the aspect should not -- occur at the point the aspect is defined, add code in the adequate -- semantic analysis procedure for the aspect. For example, this is the --- case for aspects Pre and Post on subprograms, which are pre-analyzed +-- case for aspects Pre and Post on subprograms, which are preanalyzed -- at the end of the declaration list to which the subprogram belongs, -- and fully analyzed (possibly with expansion) during the semantic -- analysis of subprogram bodies. diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb index e9d4c0fe291..51cde068db1 100644 --- a/gcc/ada/contracts.adb +++ b/gcc/ada/contracts.adb @@ -405,7 +405,7 @@ package body Contracts is then Analyze_Task_Contract (Defining_Entity (Decl)); - -- For type declarations, we need to do the pre-analysis of Iterable + -- For type declarations, we need to do the preanalysis of Iterable -- aspect specifications. -- Other type aspects need to be resolved here??? diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 0130307ae03..7573121c154 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -11194,7 +11194,7 @@ package body Exp_Util is -- Handle cases in which there is nothing to do. In GNATprove mode, -- removal of side effects is useful for the light expansion of -- renamings. This removal should only occur when not inside a - -- generic and not doing a pre-analysis. + -- generic and not doing a preanalysis. if not Expander_Active and (Inside_A_Generic or not Full_Analysis or not GNATprove_Mode) diff --git a/gcc/ada/expander.adb b/gcc/ada/expander.adb index 2e552cdb8fa..f6d91dc0bb3 100644 --- a/gcc/ada/expander.adb +++ b/gcc/ada/expander.adb @@ -125,12 +125,12 @@ package body Expander is -- The first is when are not generating code. In this mode the -- Full_Analysis flag indicates whether we are performing a complete - -- analysis, in which case Full_Analysis = True or a pre-analysis in + -- analysis, in which case Full_Analysis = True or a preanalysis in -- which case Full_Analysis = False. See the spec of Sem for more info -- on this. -- The second reason for the Expander_Active flag to be False is that - -- we are performing a pre-analysis. During pre-analysis all expansion + -- we are performing a preanalysis. During preanalysis all expansion -- activity is turned off to make sure nodes are semantically decorated -- but no extra nodes are generated. This is for instance needed for -- the first pass of aggregate semantic processing. Note that in this diff --git a/gcc/ada/expander.ads b/gcc/ada/expander.ads index 5147cbe4e78..b3e933c59ab 100644 --- a/gcc/ada/expander.ads +++ b/gcc/ada/expander.ads @@ -135,12 +135,12 @@ package Expander is -- or declaration (see routines Start_Generic_Processing and -- End_Generic_Processing in Sem_Ch12) -- - -- (b) when starting/completing the pre-analysis of an expression - -- (see the spec of package Sem for more info on pre-analysis.) + -- (b) when starting/completing the preanalysis of an expression + -- (see the spec of package Sem for more info on preanalysis.) -- -- Note that when processing a spec expression (In_Spec_Expression -- is True) or performing semantic analysis of a generic spec or body - -- (Inside_A_Generic) or when performing pre-analysis (Full_Analysis is + -- (Inside_A_Generic) or when performing preanalysis (Full_Analysis is -- False) the Expander_Active flag is False. procedure Expand (N : Node_Id); diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 72b8f9536b2..598714980b6 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -186,7 +186,7 @@ package body Freeze is -- This procedure is called for each subprogram to complete processing of -- default expressions at the point where all types are known to be frozen. -- The expressions must be analyzed in full, to make sure that all error - -- processing is done (they have only been pre-analyzed). If the expression + -- processing is done (they have only been preanalyzed). If the expression -- is not an entity or literal, its analysis may generate code which must -- not be executed. In that case we build a function body to hold that -- code. This wrapper function serves no other purpose (it used to be diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index 72cb5c00ac2..336b336365a 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -1156,7 +1156,7 @@ package body Inline is Append (Body_To_Analyze, Declarations (N)); end if; - -- The body to inline is pre-analyzed. In GNATprove mode we must disable + -- The body to inline is preanalyzed. In GNATprove mode we must disable -- full analysis as well so that light expansion does not take place -- either, and name resolution is unaffected. diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb index 8eb6504e700..eaa7aa64c49 100644 --- a/gcc/ada/lib-xref.adb +++ b/gcc/ada/lib-xref.adb @@ -666,7 +666,7 @@ package body Lib.Xref is -- Do not generate references if we are within a postcondition sub- -- program, because the reference does not comes from source, and the - -- pre-analysis of the aspect has already created an entry for the ALI + -- preanalysis of the aspect has already created an entry for the ALI -- file at the proper source location. if Chars (Current_Scope) = Name_uPostconditions then diff --git a/gcc/ada/sem.ads b/gcc/ada/sem.ads index da9a593cc8c..0d8f41d7a07 100644 --- a/gcc/ada/sem.ads +++ b/gcc/ada/sem.ads @@ -161,7 +161,7 @@ -- code for the pragma is generated. ------------------ --- Pre-Analysis -- +-- Preanalysis -- ------------------ -- For certain kind of expressions, such as aggregates, we need to defer @@ -186,17 +186,17 @@ -- expanded code for "new Thing (Function_Call)". -- To remedy this situation we introduce a flag that signals whether we want a --- full analysis (i.e. expansion is enabled) or a pre-analysis which performs +-- full analysis (i.e. expansion is enabled) or a preanalysis which performs -- Analysis and Resolution but no expansion. --- After the complete pre-analysis of an expression has been carried out we +-- After the complete preanalysis of an expression has been carried out we -- can transform the expression and then carry out the full three stage -- (Analyze-Resolve-Expand) cycle on the transformed expression top-down so -- that the expansion of inner expressions happens inside the newly generated -- node for the parent expression. -- Note that the difference between processing of default expressions and --- pre-analysis of other expressions is that we do carry out freezing in +-- preanalysis of other expressions is that we do carry out freezing in -- the latter but not in the former (except for static scalar expressions). -- The routine that performs preanalysis and corresponding resolution is -- called Preanalyze_And_Resolve and is in Sem_Res. @@ -214,12 +214,12 @@ package Sem is ----------------------------- Full_Analysis : Boolean := True; - -- Switch to indicate if we are doing a full analysis or a pre-analysis. + -- Switch to indicate if we are doing a full analysis or a preanalysis. -- In normal analysis mode (Analysis-Expansion for instructions or -- declarations) or (Analysis-Resolution-Expansion for expressions) this -- flag is set. Note that if we are not generating code the expansion phase -- merely sets the Analyzed flag to True in this case. If we are in - -- Pre-Analysis mode (see above) this flag is set to False then the + -- Preanalysis mode (see above) this flag is set to False then the -- expansion phase is skipped. -- -- When this flag is False the flag Expander_Active is also False (the @@ -688,9 +688,9 @@ package Sem is -- Determine whether preanalysis is active at the point of invocation procedure Preanalyze (N : Node_Id); - -- Performs a pre-analysis of node N. During pre-analysis no expansion is - -- carried out for N or its children. For more info on pre-analysis read - -- the spec of Sem. + -- Performs a preanalysis of node N. During preanalysis no expansion is + -- carried out for N or its children. See above for more info on + -- preanalysis. generic with procedure Action (Item : Node_Id); diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 5eaf4622d80..5e8705f90af 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -115,7 +115,7 @@ package body Sem_Aggr is -- expressions allowed for a limited component association (namely, an -- aggregate, function call, or <> notation). Report error for violations. -- Expression is also OK in an instance or inlining context, because we - -- have already pre-analyzed and it is known to be type correct. + -- have already preanalyzed and it is known to be type correct. procedure Check_Qualified_Aggregate (Level : Nat; Expr : Node_Id); -- Given aggregate Expr, check that sub-aggregates of Expr that are nested diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index f94cbadc9f8..cb1b2d5d2cc 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -1799,7 +1799,7 @@ package body Sem_Attr is -- designated type of the access type, since the type of the -- referenced array is this type (see AI95-00106). - -- As done elsewhere, freezing must not happen when pre-analyzing + -- As done elsewhere, freezing must not happen when preanalyzing -- a pre- or postcondition or a default value for an object or for -- a formal parameter. diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index d9a0344f406..d287f2632b5 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -119,7 +119,7 @@ package body Sem_Ch13 is -- Build the declaration for a predicate function. The declaration is built -- at the end of the declarative part containing the type definition, which -- may be before the freeze point of the type. The predicate expression is - -- pre-analyzed at this point, to catch visibility errors. + -- preanalyzed at this point, to catch visibility errors. procedure Build_Predicate_Functions (Typ : Entity_Id; N : Node_Id); -- If Typ has predicates (indicated by Has_Predicates being set for Typ), @@ -8839,7 +8839,7 @@ package body Sem_Ch13 is -- within a generic unit, prevent a double analysis of the body -- which will not be marked analyzed yet. This will happen when - -- the freeze node is created during the pre-analysis of an + -- the freeze node is created during the preanalysis of an -- expression function. if Inside_A_Generic then diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 3bb406da68a..b9186d73ae3 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -2218,7 +2218,7 @@ package body Sem_Ch3 is -- Context denotes the owner of the declarative list. procedure Check_Entry_Contracts; - -- Perform a pre-analysis of the pre- and postconditions of an entry + -- Perform a preanalysis of the pre- and postconditions of an entry -- declaration. This must be done before full resolution and creation -- of the parameter block, etc. to catch illegal uses within the -- contract expression. Full analysis of the expression is done when @@ -5286,7 +5286,7 @@ package body Sem_Ch3 is -- Finally this happens in some complex cases when validity checks are -- enabled, where the same subtype declaration may be analyzed twice. - -- This can happen if the subtype is created by the pre-analysis of + -- This can happen if the subtype is created by the preanalysis of -- an attribute tht gives the range of a loop statement, and the loop -- itself appears within an if_statement that will be rewritten during -- expansion. diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index 7df4fa99d13..3ce57ea3d4b 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -2278,7 +2278,7 @@ package body Sem_Ch5 is begin -- If the domain of iteration is an array component that depends - -- on a discriminant, create actual subtype for it. Pre-analysis + -- on a discriminant, create actual subtype for it. preanalysis -- does not generate the actual subtype of a selected component. if Nkind (Iter_Name) = N_Selected_Component @@ -2702,7 +2702,7 @@ package body Sem_Ch5 is -- If the iteration is given by a range, create temporaries and -- assignment statements block to capture the bounds and perform -- required finalization actions in case a bound includes a function - -- call that uses the temporary stack. We first pre-analyze a copy of + -- call that uses the temporary stack. We first preanalyze a copy of -- the range in order to determine the expected type, and analyze and -- resolve the original bounds. @@ -3131,7 +3131,7 @@ package body Sem_Ch5 is else -- A quantified expression that appears in a pre/post condition - -- is pre-analyzed several times. If the range is given by an + -- is preanalyzed several times. If the range is given by an -- attribute reference it is rewritten as a range, and this is -- done even with expansion disabled. If the type is already set -- do not reanalyze, because a range with static bounds may be diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 1580be1a2ad..f000f71a3a9 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -708,7 +708,7 @@ package body Sem_Ch6 is Set_Corresponding_Body (N, Defining_Entity (New_Body)); Set_Corresponding_Spec (New_Body, Def_Id); - -- Within a generic pre-analyze the original expression for name + -- Within a generic preanalyze the original expression for name -- capture. The body is also generated but plays no role in -- this because it is not part of the original source. @@ -3643,7 +3643,7 @@ package body Sem_Ch6 is if No (Spec_Id) and then GNATprove_Mode - -- Inlining does not apply during pre-analysis of code + -- Inlining does not apply during preanalysis of code and then Full_Analysis diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 1716cc47666..02471d73bbb 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -7109,7 +7109,7 @@ package body Sem_Ch8 is end if; -- If the selected component appears within a default expression - -- and it has an actual subtype, the pre-analysis has not yet + -- and it has an actual subtype, the preanalysis has not yet -- completed its analysis, because Insert_Actions is disabled in -- that context. Within the init proc of the enclosing type we -- must complete this analysis, if an actual subtype was created. diff --git a/gcc/ada/sem_dim.adb b/gcc/ada/sem_dim.adb index 9cdc9bb6870..884c86f5aa2 100644 --- a/gcc/ada/sem_dim.adb +++ b/gcc/ada/sem_dim.adb @@ -1558,7 +1558,7 @@ package body Sem_Dim is -- For relational operations, only dimension checking is -- performed (no propagation). If one operand is the result -- of constant folding the dimensions may have been lost - -- in a tree copy, so assume that pre-analysis has verified + -- in a tree copy, so assume that preanalysis has verified -- that dimensions are correct. elsif N_Kind in N_Op_Compare then diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb index e3169952803..72bb0cbc46e 100644 --- a/gcc/ada/sem_elab.adb +++ b/gcc/ada/sem_elab.adb @@ -12945,7 +12945,7 @@ package body Sem_Elab is then return; - -- Nothing to do if call is being pre-analyzed, as when within a + -- Nothing to do if call is being preanalyzed, as when within a -- pre/postcondition, a predicate, or an invariant. elsif In_Spec_Expression then diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index a2788d99922..9df0cd6ae5a 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -6676,7 +6676,7 @@ package body Sem_Res is Cannot_Inline ("cannot inline & (in default expression)?", N, Nam_UA); - -- Inlining should not be performed during pre-analysis + -- Inlining should not be performed during preanalysis elsif Full_Analysis then diff --git a/gcc/ada/sem_res.ads b/gcc/ada/sem_res.ads index 01aad880459..58c8b5ebaa6 100644 --- a/gcc/ada/sem_res.ads +++ b/gcc/ada/sem_res.ads @@ -85,9 +85,9 @@ package Sem_Res is -- The parameter T is the Typ for the corresponding resolve call. procedure Preanalyze_And_Resolve (N : Node_Id; T : Entity_Id); - -- Performs a pre-analysis of expression node N. During pre-analysis, N is + -- Performs a preanalysis of expression node N. During preanalysis, N is -- analyzed and then resolved against type T, but no expansion is carried - -- out for N or its children. For more info on pre-analysis read the spec + -- out for N or its children. For more info on preanalysis read the spec -- of Sem. procedure Preanalyze_And_Resolve (N : Node_Id); diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index b09ca100044..6aaeff86c25 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -640,7 +640,7 @@ package Sinfo is -- The tree after this light expansion should be fully analyzed -- semantically, which sometimes requires the insertion of semantic - -- pre-analysis, for example for subprogram contracts and pragma + -- preanalysis, for example for subprogram contracts and pragma -- check/assert. In particular, all expression must have their proper type, -- and semantic links should be set between tree nodes (partial to full -- view, etc.) Some kinds of nodes should be either absent, or can be -- 2.30.2