comparison 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
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
4 -- -- 4 -- --
5 -- S E M _ E L A B -- 5 -- S E M _ E L A B --
6 -- -- 6 -- --
7 -- S p e c -- 7 -- S p e c --
8 -- -- 8 -- --
9 -- Copyright (C) 1997-2017, Free Software Foundation, Inc. -- 9 -- Copyright (C) 1997-2018, Free Software Foundation, Inc. --
10 -- -- 10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under -- 11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- -- 12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- -- 13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- 14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
31 package Sem_Elab is 31 package Sem_Elab is
32 32
33 procedure Build_Call_Marker (N : Node_Id); 33 procedure Build_Call_Marker (N : Node_Id);
34 -- Create a call marker for call or requeue statement N and record it for 34 -- Create a call marker for call or requeue statement N and record it for
35 -- later processing by the ABE mechanism. 35 -- later processing by the ABE mechanism.
36
37 procedure Build_Variable_Reference_Marker
38 (N : Node_Id;
39 Read : Boolean;
40 Write : Boolean);
41 -- Create a variable reference marker for arbitrary node N if it mentions a
42 -- variable, and record it for later processing by the ABE mechanism. Flag
43 -- Read should be set when the reference denotes a read. Flag Write should
44 -- be set when the reference denotes a write.
36 45
37 procedure Check_Elaboration_Scenarios; 46 procedure Check_Elaboration_Scenarios;
38 -- Examine each scenario recorded during analysis/resolution and apply the 47 -- Examine each scenario recorded during analysis/resolution and apply the
39 -- Ada or SPARK elaboration rules taking into account the model in effect. 48 -- Ada or SPARK elaboration rules taking into account the model in effect.
40 -- This processing detects and diagnoses ABE issues, installs conditional 49 -- This processing detects and diagnoses ABE issues, installs conditional
82 91
83 No_Level); 92 No_Level);
84 -- This value is used to indicate that none of the levels above are in 93 -- This value is used to indicate that none of the levels above are in
85 -- effect. 94 -- effect.
86 95
96 subtype Any_Library_Level is Enclosing_Level_Kind range
97 Generic_Package_Spec ..
98 Package_Body;
99
87 subtype Generic_Library_Level is Enclosing_Level_Kind range 100 subtype Generic_Library_Level is Enclosing_Level_Kind range
88 Generic_Package_Spec .. 101 Generic_Package_Spec ..
89 Generic_Package_Body; 102 Generic_Package_Body;
90 103
91 subtype Library_Level is Enclosing_Level_Kind range 104 subtype Library_Level is Enclosing_Level_Kind range
92 Package_Spec .. 105 Package_Spec ..
93 Package_Body; 106 Package_Body;
94 107
95 subtype Any_Library_Level is Enclosing_Level_Kind range 108 subtype Library_Or_Instantiation_Level is Enclosing_Level_Kind range
96 Generic_Package_Spec .. 109 Instantiation ..
97 Package_Body; 110 Package_Body;
98 111
99 function Find_Enclosing_Level (N : Node_Id) return Enclosing_Level_Kind; 112 function Find_Enclosing_Level (N : Node_Id) return Enclosing_Level_Kind;
100 -- Determine the enclosing level of arbitrary node N 113 -- Determine the enclosing level of arbitrary node N
101 114
110 procedure Record_Elaboration_Scenario (N : Node_Id); 123 procedure Record_Elaboration_Scenario (N : Node_Id);
111 -- Determine whether atribtray node N denotes a scenario which requires 124 -- Determine whether atribtray node N denotes a scenario which requires
112 -- ABE diagnostics or runtime checks. If this is the case, store N into 125 -- ABE diagnostics or runtime checks. If this is the case, store N into
113 -- a table for later processing. 126 -- a table for later processing.
114 127
128 ---------------------------------------------------------------------------
129 -- --
130 -- 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 --
131 -- --
132 -- M E C H A N I S M --
133 -- --
134 ---------------------------------------------------------------------------
135
136 -- This section contains the implementation of the pre-18.x Legacy ABE
137 -- Mechanism. The mechanism can be activated using switch -gnatH (legacy
138 -- elaboration checking mode enabled).
139
140 procedure Check_Elab_Assign (N : Node_Id);
141 -- N is either the left side of an assignment, or a procedure argument for
142 -- a mode OUT or IN OUT formal. This procedure checks for a possible case
143 -- of access to an entity from elaboration code before the entity has been
144 -- initialized, and issues appropriate warnings.
145
146 procedure Check_Elab_Call
147 (N : Node_Id;
148 Outer_Scope : Entity_Id := Empty;
149 In_Init_Proc : Boolean := False);
150 -- Check a call for possible elaboration problems. The node N is either an
151 -- N_Function_Call or N_Procedure_Call_Statement node or an access
152 -- attribute reference whose prefix is a subprogram.
153 --
154 -- If SPARK_Mode is On, then N can also be a variable reference, since
155 -- SPARK requires the use of Elaborate_All for references to variables
156 -- in other packages.
157
158 -- The Outer_Scope argument indicates whether this is an outer level
159 -- call from Sem_Res (Outer_Scope set to Empty), or an internal recursive
160 -- call (Outer_Scope set to entity of outermost call, see body). The flag
161 -- In_Init_Proc should be set whenever the current context is a type
162 -- init proc.
163
164 -- Note: this might better be called Check_Elab_Reference (to recognize
165 -- the SPARK case), but we prefer to keep the original name, since this
166 -- is primarily used for checking for calls that could generate an ABE).
167
168 procedure Check_Elab_Calls;
169 -- Not all the processing for Check_Elab_Call can be done at the time
170 -- of calls to Check_Elab_Call. This is because for internal calls, we
171 -- need to wait to complete the check until all generic bodies have been
172 -- instantiated. The Check_Elab_Calls procedure cleans up these waiting
173 -- checks. It is called once after the completion of instantiation.
174
175 procedure Check_Elab_Instantiation
176 (N : Node_Id;
177 Outer_Scope : Entity_Id := Empty);
178 -- Check an instantiation for possible elaboration problems. N is an
179 -- instantiation node (N_Package_Instantiation, N_Function_Instantiation,
180 -- or N_Procedure_Instantiation), and Outer_Scope indicates if this is
181 -- an outer level call from Sem_Ch12 (Outer_Scope set to Empty), or an
182 -- internal recursive call (Outer_Scope set to scope of outermost call,
183 -- see body for further details). The returned value is relevant only
184 -- for an outer level call, and is set to False if an elaboration error
185 -- is bound to occur on the instantiation, and True otherwise. This is
186 -- used by the caller to signal that the body of the instance should
187 -- not be generated (see detailed description in body).
188
189 procedure Check_Task_Activation (N : Node_Id);
190 -- At the point at which tasks are activated in a package body, check
191 -- that the bodies of the tasks are elaborated.
192
115 end Sem_Elab; 193 end Sem_Elab;