Mercurial > hg > CbC > CbC_gcc
diff gcc/ada/sem_elab.ads @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
line wrap: on
line diff
--- a/gcc/ada/sem_elab.ads Fri Oct 27 22:46:09 2017 +0900 +++ b/gcc/ada/sem_elab.ads Thu Oct 25 07:37:49 2018 +0900 @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1997-2017, Free Software Foundation, Inc. -- +-- Copyright (C) 1997-2018, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -34,6 +34,15 @@ -- Create a call marker for call or requeue statement N and record it for -- later processing by the ABE mechanism. + procedure Build_Variable_Reference_Marker + (N : Node_Id; + Read : Boolean; + Write : Boolean); + -- Create a variable reference marker for arbitrary node N if it mentions a + -- variable, and record it for later processing by the ABE mechanism. Flag + -- Read should be set when the reference denotes a read. Flag Write should + -- be set when the reference denotes a write. + procedure Check_Elaboration_Scenarios; -- Examine each scenario recorded during analysis/resolution and apply the -- Ada or SPARK elaboration rules taking into account the model in effect. @@ -84,6 +93,10 @@ -- This value is used to indicate that none of the levels above are in -- effect. + subtype Any_Library_Level is Enclosing_Level_Kind range + Generic_Package_Spec .. + Package_Body; + subtype Generic_Library_Level is Enclosing_Level_Kind range Generic_Package_Spec .. Generic_Package_Body; @@ -92,8 +105,8 @@ Package_Spec .. Package_Body; - subtype Any_Library_Level is Enclosing_Level_Kind range - Generic_Package_Spec .. + subtype Library_Or_Instantiation_Level is Enclosing_Level_Kind range + Instantiation .. Package_Body; function Find_Enclosing_Level (N : Node_Id) return Enclosing_Level_Kind; @@ -112,4 +125,69 @@ -- ABE diagnostics or runtime checks. If this is the case, store N into -- a table for later processing. + --------------------------------------------------------------------------- + -- -- + -- L E G A C Y A C C E S S B E F O R E E L A B O R A T I O N -- + -- -- + -- M E C H A N I S M -- + -- -- + --------------------------------------------------------------------------- + + -- This section contains the implementation of the pre-18.x Legacy ABE + -- Mechanism. The mechanism can be activated using switch -gnatH (legacy + -- elaboration checking mode enabled). + + procedure Check_Elab_Assign (N : Node_Id); + -- N is either the left side of an assignment, or a procedure argument for + -- a mode OUT or IN OUT formal. This procedure checks for a possible case + -- of access to an entity from elaboration code before the entity has been + -- initialized, and issues appropriate warnings. + + procedure Check_Elab_Call + (N : Node_Id; + Outer_Scope : Entity_Id := Empty; + In_Init_Proc : Boolean := False); + -- Check a call for possible elaboration problems. The node N is either an + -- N_Function_Call or N_Procedure_Call_Statement node or an access + -- attribute reference whose prefix is a subprogram. + -- + -- If SPARK_Mode is On, then N can also be a variable reference, since + -- SPARK requires the use of Elaborate_All for references to variables + -- in other packages. + + -- The Outer_Scope argument indicates whether this is an outer level + -- call from Sem_Res (Outer_Scope set to Empty), or an internal recursive + -- call (Outer_Scope set to entity of outermost call, see body). The flag + -- In_Init_Proc should be set whenever the current context is a type + -- init proc. + + -- Note: this might better be called Check_Elab_Reference (to recognize + -- the SPARK case), but we prefer to keep the original name, since this + -- is primarily used for checking for calls that could generate an ABE). + + procedure Check_Elab_Calls; + -- Not all the processing for Check_Elab_Call can be done at the time + -- of calls to Check_Elab_Call. This is because for internal calls, we + -- need to wait to complete the check until all generic bodies have been + -- instantiated. The Check_Elab_Calls procedure cleans up these waiting + -- checks. It is called once after the completion of instantiation. + + procedure Check_Elab_Instantiation + (N : Node_Id; + Outer_Scope : Entity_Id := Empty); + -- Check an instantiation for possible elaboration problems. N is an + -- instantiation node (N_Package_Instantiation, N_Function_Instantiation, + -- or N_Procedure_Instantiation), and Outer_Scope indicates if this is + -- an outer level call from Sem_Ch12 (Outer_Scope set to Empty), or an + -- internal recursive call (Outer_Scope set to scope of outermost call, + -- see body for further details). The returned value is relevant only + -- for an outer level call, and is set to False if an elaboration error + -- is bound to occur on the instantiation, and True otherwise. This is + -- used by the caller to signal that the body of the instance should + -- not be generated (see detailed description in body). + + procedure Check_Task_Activation (N : Node_Id); + -- At the point at which tasks are activated in a package body, check + -- that the bodies of the tasks are elaborated. + end Sem_Elab;