Add assember CFI directives to millicode division and remainder routines.
[official-gcc.git] / gcc / ada / sem_prag.ads
blobfa7e7073f5a1da81ff4e988abd9d64373a7e5bac
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S E M _ P R A G --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2023, Free Software Foundation, Inc. --
10 -- --
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- --
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- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
20 -- --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
23 -- --
24 ------------------------------------------------------------------------------
26 -- Pragma handling is isolated in a separate package
27 -- (logically this processing belongs in chapter 4)
29 with Namet; use Namet;
30 with Opt; use Opt;
31 with Snames; use Snames;
32 with Types; use Types;
34 package Sem_Prag is
36 -- The following table lists all pragmas that emulate an Ada 2012 aspect
38 Aspect_Specifying_Pragma : constant array (Pragma_Id) of Boolean :=
39 (Pragma_Abstract_State => True,
40 Pragma_All_Calls_Remote => True,
41 Pragma_Annotate => True,
42 Pragma_Async_Readers => True,
43 Pragma_Async_Writers => True,
44 Pragma_Asynchronous => True,
45 Pragma_Atomic => True,
46 Pragma_Atomic_Components => True,
47 Pragma_Attach_Handler => True,
48 Pragma_Constant_After_Elaboration => True,
49 Pragma_Contract_Cases => True,
50 Pragma_Convention => True,
51 Pragma_CPU => True,
52 Pragma_CUDA_Device => True,
53 Pragma_CUDA_Global => True,
54 Pragma_Default_Initial_Condition => True,
55 Pragma_Default_Storage_Pool => True,
56 Pragma_Depends => True,
57 Pragma_Discard_Names => True,
58 Pragma_Dispatching_Domain => True,
59 Pragma_Effective_Reads => True,
60 Pragma_Effective_Writes => True,
61 Pragma_Elaborate_Body => True,
62 Pragma_Export => True,
63 Pragma_Extensions_Visible => True,
64 Pragma_Favor_Top_Level => True,
65 Pragma_Ghost => True,
66 Pragma_Global => True,
67 Pragma_GNAT_Annotate => True,
68 Pragma_Import => True,
69 Pragma_Independent => True,
70 Pragma_Independent_Components => True,
71 Pragma_Initial_Condition => True,
72 Pragma_Initializes => True,
73 Pragma_Inline => True,
74 Pragma_Inline_Always => True,
75 Pragma_Interrupt_Handler => True,
76 Pragma_Interrupt_Priority => True,
77 Pragma_Invariant => True,
78 Pragma_Linker_Section => True,
79 Pragma_Lock_Free => True,
80 Pragma_No_Elaboration_Code_All => True,
81 Pragma_No_Return => True,
82 Pragma_Obsolescent => True,
83 Pragma_Pack => True,
84 Pragma_Part_Of => True,
85 Pragma_Persistent_BSS => True,
86 Pragma_Post => True,
87 Pragma_Post_Class => True,
88 Pragma_Postcondition => True,
89 Pragma_Pre => True,
90 Pragma_Pre_Class => True,
91 Pragma_Precondition => True,
92 Pragma_Predicate => True,
93 Pragma_Preelaborable_Initialization => True,
94 Pragma_Preelaborate => True,
95 Pragma_Priority => True,
96 Pragma_Pure => True,
97 Pragma_Pure_Function => True,
98 Pragma_Refined_Depends => True,
99 Pragma_Refined_Global => True,
100 Pragma_Refined_Post => True,
101 Pragma_Refined_State => True,
102 Pragma_Relative_Deadline => True,
103 Pragma_Remote_Access_Type => True,
104 Pragma_Remote_Call_Interface => True,
105 Pragma_Remote_Types => True,
106 Pragma_Secondary_Stack_Size => True,
107 Pragma_Shared => True,
108 Pragma_Shared_Passive => True,
109 Pragma_Simple_Storage_Pool_Type => True,
110 Pragma_SPARK_Mode => True,
111 Pragma_Storage_Size => True,
112 Pragma_Suppress => True,
113 Pragma_Suppress_Debug_Info => True,
114 Pragma_Suppress_Initialization => True,
115 Pragma_Test_Case => True,
116 Pragma_Thread_Local_Storage => True,
117 Pragma_Type_Invariant => True,
118 Pragma_Unchecked_Union => True,
119 Pragma_Universal_Aliasing => True,
120 Pragma_Unmodified => True,
121 Pragma_Unreferenced => True,
122 Pragma_Unreferenced_Objects => True,
123 Pragma_Unsuppress => True,
124 Pragma_Volatile => True,
125 Pragma_Volatile_Components => True,
126 Pragma_Volatile_Full_Access => True,
127 Pragma_Warnings => True,
128 others => False);
130 -- The following table lists all pragmas that act as an assertion
131 -- expression.
133 Assertion_Expression_Pragma : constant array (Pragma_Id) of Boolean :=
134 (Pragma_Assert => True,
135 Pragma_Assert_And_Cut => True,
136 Pragma_Assume => True,
137 Pragma_Check => True,
138 Pragma_Compile_Time_Error => True,
139 Pragma_Contract_Cases => True,
140 Pragma_Default_Initial_Condition => True,
141 Pragma_Initial_Condition => True,
142 Pragma_Invariant => True,
143 Pragma_Loop_Invariant => True,
144 Pragma_Loop_Variant => True,
145 Pragma_Post => True,
146 Pragma_Post_Class => True,
147 Pragma_Postcondition => True,
148 Pragma_Pre => True,
149 Pragma_Pre_Class => True,
150 Pragma_Precondition => True,
151 Pragma_Predicate => True,
152 Pragma_Refined_Post => True,
153 Pragma_Subprogram_Variant => True,
154 Pragma_Test_Case => True,
155 Pragma_Type_Invariant => True,
156 Pragma_Type_Invariant_Class => True,
157 others => False);
159 -- Should to following constant arrays be renamed to better suit their
160 -- use as a predicate (e.g. Is_Pragma_*) ???
162 -- The following table lists all the implementation-defined pragmas that
163 -- should apply to the anonymous object produced by the analysis of a
164 -- single protected or task type. The table should be synchronized with
165 -- Aspect_On_Anonymous_Object_OK in unit Aspects.
167 Pragma_On_Anonymous_Object_OK : constant array (Pragma_Id) of Boolean :=
168 (Pragma_Depends => True,
169 Pragma_Global => True,
170 Pragma_Part_Of => True,
171 others => False);
173 -- The following table lists all the implementation-defined pragmas that
174 -- may apply to a body stub (no language defined pragmas apply). The table
175 -- should be synchronized with Aspect_On_Body_Or_Stub_OK in unit Aspects.
177 Pragma_On_Body_Or_Stub_OK : constant array (Pragma_Id) of Boolean :=
178 (Pragma_Refined_Depends => True,
179 Pragma_Refined_Global => True,
180 Pragma_Refined_Post => True,
181 Pragma_SPARK_Mode => True,
182 Pragma_Warnings => True,
183 others => False);
185 -- The following table lists all pragmas which are significant in SPARK and
186 -- as a result get translated into verification conditions. The table is an
187 -- amalgamation of the pragmas listed in SPARK RM 16.1 and internally added
188 -- entries.
190 Pragma_Significant_In_SPARK : constant array (Pragma_Id) of Boolean :=
191 (Pragma_All_Calls_Remote => False,
192 Pragma_Asynchronous => False,
193 Pragma_Default_Storage_Pool => False,
194 Pragma_Discard_Names => False,
195 Pragma_Dispatching_Domain => False,
196 Pragma_Priority_Specific_Dispatching => False,
197 Pragma_Remote_Call_Interface => False,
198 Pragma_Remote_Types => False,
199 Pragma_Shared_Passive => False,
200 Pragma_Task_Dispatching_Policy => False,
201 Pragma_Unmodified => False,
202 Pragma_Unreferenced => False,
203 Pragma_Warnings => False,
204 others => True);
206 -- The following table lists all pragmas which are relevant to the analysis
207 -- of subprogram bodies.
209 Pragma_Significant_To_Subprograms : constant array (Pragma_Id) of Boolean :=
210 (Pragma_Contract_Cases => True,
211 Pragma_Depends => True,
212 Pragma_Ghost => True,
213 Pragma_Global => True,
214 Pragma_Inline => True,
215 Pragma_Inline_Always => True,
216 Pragma_Post => True,
217 Pragma_Post_Class => True,
218 Pragma_Postcondition => True,
219 Pragma_Pre => True,
220 Pragma_Pre_Class => True,
221 Pragma_Precondition => True,
222 Pragma_Pure => True,
223 Pragma_Pure_Function => True,
224 Pragma_Refined_Depends => True,
225 Pragma_Refined_Global => True,
226 Pragma_Refined_Post => True,
227 Pragma_Refined_State => True,
228 Pragma_Volatile => True,
229 Pragma_Volatile_Function => True,
230 others => False);
232 -----------------
233 -- Subprograms --
234 -----------------
236 procedure Analyze_Pragma (N : Node_Id);
237 -- Analyze procedure for pragma reference node N
239 procedure Analyze_Contract_Cases_In_Decl_Part
240 (N : Node_Id;
241 Freeze_Id : Entity_Id := Empty);
242 -- Perform full analysis of delayed pragma Contract_Cases. Freeze_Id is the
243 -- entity of [generic] package body or [generic] subprogram body which
244 -- caused "freezing" of the related contract where the pragma resides.
246 procedure Analyze_Depends_In_Decl_Part (N : Node_Id);
247 -- Perform full analysis of delayed pragma Depends. This routine is also
248 -- capable of performing basic analysis of pragma Refined_Depends.
250 procedure Analyze_External_Property_In_Decl_Part
251 (N : Node_Id;
252 Expr_Val : out Boolean);
253 -- Perform full analysis of delayed pragmas Async_Readers, Async_Writers,
254 -- Effective_Reads, Effective_Writes and No_Caching. Flag Expr_Val contains
255 -- the Boolean argument of the pragma or a default True if no argument
256 -- is present.
258 procedure Analyze_Global_In_Decl_Part (N : Node_Id);
259 -- Perform full analysis of delayed pragma Global. This routine is also
260 -- capable of performing basic analysis of pragma Refined_Global.
262 procedure Analyze_Initial_Condition_In_Decl_Part (N : Node_Id);
263 -- Perform full analysis of delayed pragma Initial_Condition
265 procedure Analyze_Initializes_In_Decl_Part (N : Node_Id);
266 -- Perform full analysis of delayed pragma Initializes
268 procedure Analyze_Part_Of_In_Decl_Part
269 (N : Node_Id;
270 Freeze_Id : Entity_Id := Empty);
271 -- Perform full analysis of delayed pragma Part_Of. Freeze_Id is the entity
272 -- of [generic] package body or [generic] subprogram body which caused the
273 -- "freezing" of the related contract where the pragma resides.
275 procedure Analyze_Pre_Post_Condition_In_Decl_Part
276 (N : Node_Id;
277 Freeze_Id : Entity_Id := Empty);
278 -- Perform full analysis of pragmas Precondition and Postcondition.
279 -- Freeze_Id denotes the entity of [generic] package body or [generic]
280 -- subprogram body which caused "freezing" of the related contract where
281 -- the pragma resides.
283 procedure Analyze_Refined_Depends_In_Decl_Part (N : Node_Id);
284 -- Preform full analysis of delayed pragma Refined_Depends. This routine
285 -- uses Analyze_Depends_In_Decl_Part as a starting point, then performs
286 -- various consistency checks between Depends and Refined_Depends.
288 procedure Analyze_Refined_Global_In_Decl_Part (N : Node_Id);
289 -- Perform full analysis of delayed pragma Refined_Global. This routine
290 -- uses Analyze_Global_In_Decl_Part as a starting point, then performs
291 -- various consistency checks between Global and Refined_Global.
293 procedure Analyze_Refined_State_In_Decl_Part
294 (N : Node_Id;
295 Freeze_Id : Entity_Id := Empty);
296 -- Perform full analysis of delayed pragma Refined_State. Freeze_Id denotes
297 -- the entity of [generic] package body or [generic] subprogram body which
298 -- caused "freezing" of the related contract where the pragma resides.
300 procedure Analyze_Subprogram_Variant_In_Decl_Part
301 (N : Node_Id;
302 Freeze_Id : Entity_Id := Empty);
303 -- Perform full analysis of delayed pragma Subprogram_Variant. Freeze_Id is
304 -- the entity of [generic] package body or [generic] subprogram body which
305 -- caused "freezing" of the related contract where the pragma resides.
307 procedure Analyze_Test_Case_In_Decl_Part (N : Node_Id);
308 -- Perform preanalysis of pragma Test_Case
310 function Build_Pragma_Check_Equivalent
311 (Prag : Node_Id;
312 Subp_Id : Entity_Id := Empty;
313 Inher_Id : Entity_Id := Empty;
314 Keep_Pragma_Id : Boolean := False) return Node_Id;
315 -- Transform a pre- or [refined] postcondition denoted by Prag into an
316 -- equivalent pragma Check. When the pre- or postcondition is inherited,
317 -- the routine replaces the references of all formals of Inher_Id
318 -- and primitive operations of its controlling type by references
319 -- to the corresponding entities of Subp_Id and the descendant type.
320 -- Keep_Pragma_Id is True when the newly created pragma should be
321 -- in fact of the same kind as the source pragma Prag. This is used
322 -- in GNATprove_Mode to generate the inherited pre- and postconditions.
324 procedure Check_Applicable_Policy (N : Node_Id);
325 -- N is either an N_Aspect or an N_Pragma node. There are two cases. If
326 -- the name of the aspect or pragma is not one of those recognized as
327 -- an assertion kind by an Assertion_Policy pragma, then the call has
328 -- no effect. Note that in the case of a pragma derived from an aspect,
329 -- the name we use for the purpose of this procedure is the aspect name,
330 -- which may be different from the pragma name (e.g. Precondition for
331 -- Pre aspect). In addition, 'Class aspects are recognized (and the
332 -- corresponding special names used in the processing).
334 -- If the name is a valid assertion kind name, then the Check_Policy pragma
335 -- chain is checked for a matching entry (or for an Assertion entry which
336 -- matches all possibilities). If a matching entry is found then the policy
337 -- is checked. If it is On or Check, then the Is_Checked flag is set in
338 -- the aspect or pragma node. If it is Off, Ignore, or Disable, then the
339 -- Is_Ignored flag is set in the aspect or pragma node. Additionally for
340 -- policy Disable, the Is_Disabled flag is set.
342 -- If no matching Check_Policy pragma is found then the effect depends on
343 -- whether -gnata was used, if so, then the call has no effect, otherwise
344 -- Is_Ignored (but not Is_Disabled) is set True.
346 procedure Check_External_Properties
347 (Item : Node_Id;
348 AR : Boolean;
349 AW : Boolean;
350 ER : Boolean;
351 EW : Boolean);
352 -- Flags AR, AW, ER and EW denote the static values of external properties
353 -- Async_Readers, Async_Writers, Effective_Reads and Effective_Writes. Item
354 -- is the related variable or state. Ensure legality of the combination and
355 -- issue an error for an illegal combination.
357 function Check_Kind (Nam : Name_Id) return Name_Id;
358 -- This function is used in connection with pragmas Assert, Check,
359 -- and assertion aspects and pragmas, to determine if Check pragmas
360 -- (or corresponding assertion aspects or pragmas) are currently active
361 -- as determined by the presence of -gnata on the command line (which
362 -- sets the default), and the appearance of pragmas Check_Policy and
363 -- Assertion_Policy as configuration pragmas either in a configuration
364 -- pragma file, or at the start of the current unit, or locally given
365 -- Check_Policy and Assertion_Policy pragmas that are currently active.
367 -- The value returned is one of the names Check, Ignore, Disable (On
368 -- returns Check, and Off returns Ignore).
370 -- Note: for assertion kinds Pre'Class, Post'Class, Invariant'Class,
371 -- and Type_Invariant'Class, the name passed is Name_uPre, Name_uPost,
372 -- Name_uInvariant, or Name_uType_Invariant, which corresponds to _Pre,
373 -- _Post, _Invariant, or _Type_Invariant, which are special names used
374 -- in identifiers to represent these attribute references.
376 procedure Check_Missing_Part_Of (Item_Id : Entity_Id);
377 -- Determine whether the placement within the state space of an abstract
378 -- state, variable or package instantiation denoted by Item_Id requires the
379 -- use of indicator/option Part_Of. If this is the case, emit an error.
381 procedure Collect_Inherited_Class_Wide_Conditions (Subp : Entity_Id);
382 -- In GNATprove mode, when analyzing an overriding subprogram, check
383 -- whether the overridden operations have class-wide pre/postconditions,
384 -- and generate the corresponding pragmas. The pragmas are inserted after
385 -- the subprogram declaration, together with those generated for other
386 -- aspects of the subprogram.
388 procedure Collect_Subprogram_Inputs_Outputs
389 (Subp_Id : Entity_Id;
390 Synthesize : Boolean := False;
391 Subp_Inputs : in out Elist_Id;
392 Subp_Outputs : in out Elist_Id;
393 Global_Seen : out Boolean);
394 -- Subsidiary to the analysis of pragmas Depends, Global, Refined_Depends
395 -- and Refined_Global. Collect all inputs and outputs of subprogram Subp_Id
396 -- in lists Subp_Inputs (inputs) and Subp_Outputs (outputs). The inputs and
397 -- outputs are gathered from:
398 -- 1) The formal parameters of the subprogram
399 -- 2) The generic formal parameters of the generic subprogram
400 -- 3) The current instance of a concurrent type
401 -- 4) The items of pragma [Refined_]Global
402 -- or
403 -- 5) The items of pragma [Refined_]Depends if there is no pragma
404 -- [Refined_]Global present and flag Synthesize is set to True.
405 -- If the subprogram has no inputs and/or outputs, then the returned list
406 -- is No_Elist. Flag Global_Seen is set when the related subprogram has
407 -- pragma [Refined_]Global.
409 function Delay_Config_Pragma_Analyze (N : Node_Id) return Boolean;
410 -- N is a pragma appearing in a configuration pragma file. Most such
411 -- pragmas are analyzed when the file is read, before parsing and analyzing
412 -- the main unit. However, the analysis of certain pragmas results in
413 -- adding information to the compiled main unit, and this cannot be done
414 -- till the main unit is processed. Such pragmas return True from this
415 -- function and in Frontend pragmas where Delay_Config_Pragma_Analyze is
416 -- True have their analysis delayed until after the main program is parsed
417 -- and analyzed.
419 function Find_Related_Package_Or_Body
420 (Prag : Node_Id;
421 Do_Checks : Boolean := False) return Node_Id;
422 -- Subsidiary to the analysis of pragmas
423 -- Abstract_State
424 -- Initial_Condition
425 -- Initializes
426 -- Refined_State
427 -- Find the declaration of the related package [body] subject to pragma
428 -- Prag. The return value is either N_Package_Declaration, N_Package_Body,
429 -- or Empty if the placement of the pragma is illegal. If flag Do_Checks is
430 -- set, the routine reports duplicate pragmas.
432 function Find_Related_Declaration_Or_Body
433 (Prag : Node_Id;
434 Do_Checks : Boolean := False) return Node_Id;
435 -- Subsidiary to the analysis of pragmas
436 -- Contract_Cases
437 -- Depends
438 -- Extensions_Visible
439 -- Global
440 -- Initializes
441 -- Max_Entry_Queue_Depth
442 -- Max_Entry_Queue_Length
443 -- Max_Queue_Length
444 -- Post
445 -- Post_Class
446 -- Postcondition
447 -- Pre
448 -- Pre_Class
449 -- Precondition
450 -- Refined_Depends
451 -- Refined_Global
452 -- Refined_Post
453 -- Refined_State
454 -- Test_Case
455 -- Volatile_Function
456 -- as well as attributes 'Old and 'Result. Find the declaration of the
457 -- related entry, subprogram or task type [body] subject to pragma Prag.
458 -- If flag Do_Checks is set, the routine reports duplicate pragmas and
459 -- detects improper use of refinement pragmas in stand alone expression
460 -- functions.
462 function Get_Argument
463 (Prag : Node_Id;
464 Context_Id : Entity_Id := Empty) return Node_Id;
465 -- Obtain the argument of pragma Prag depending on context and the nature
466 -- of the pragma. The argument is extracted in the following manner:
468 -- When the pragma is generated from an aspect, return the corresponding
469 -- aspect when Context_Id denotes a generic unit.
471 -- Otherwise return the first argument of Prag
473 -- Context denotes the entity of the function, package or procedure where
474 -- Prag resides.
476 function Get_SPARK_Mode_From_Annotation
477 (N : Node_Id) return SPARK_Mode_Type;
478 -- Given an aspect or pragma SPARK_Mode node, return corresponding mode id
480 procedure Initialize;
481 -- Initializes data structures used for pragma processing. Must be called
482 -- before analyzing each new main source program.
484 function Is_Config_Static_String (Arg : Node_Id) return Boolean;
485 -- This is called for a configuration pragma that requires either string
486 -- literal or a concatenation of string literals. We cannot use normal
487 -- static string processing because it is too early in the case of the
488 -- pragma appearing in a configuration pragmas file. If Arg is of an
489 -- appropriate form, then this call obtains the string (doing any necessary
490 -- concatenations) and places it in Name_Buffer, setting Name_Len to its
491 -- length, and then returns True. If it is not of the correct form, then an
492 -- appropriate error message is posted, and False is returned.
494 function Is_Elaboration_SPARK_Mode (N : Node_Id) return Boolean;
495 -- Determine whether pragma SPARK_Mode appears in the statement part of a
496 -- package body.
498 function Is_Enabled_Pragma (Prag : Node_Id) return Boolean;
499 -- Determine whether a Boolean-like SPARK pragma Prag is enabled. To be
500 -- considered enabled, the pragma must either:
501 -- * Appear without its Boolean expression
502 -- * The Boolean expression evaluates to "True"
504 -- Boolean-like SPARK pragmas differ from pure Boolean Ada pragmas in that
505 -- their optional Boolean expression must be static and cannot benefit from
506 -- forward references. The following are Boolean-like SPARK pragmas:
507 -- Async_Readers
508 -- Async_Writers
509 -- Constant_After_Elaboration
510 -- Effective_Reads
511 -- Effective_Writes
512 -- Extensions_Visible
513 -- Volatile_Function
515 function Is_Non_Significant_Pragma_Reference (N : Node_Id) return Boolean;
516 -- The node N is a node for an entity and the issue is whether the
517 -- occurrence is a reference for the purposes of giving warnings about
518 -- unreferenced variables. This function returns True if the reference is
519 -- not a reference from this point of view (e.g. the occurrence in a pragma
520 -- Pack) and False if it is a real reference (e.g. the occurrence in a
521 -- pragma Export);
523 function Is_Pragma_String_Literal (Par : Node_Id) return Boolean;
524 -- Given an N_Pragma_Argument_Association node, Par, which has the form of
525 -- an operator symbol, determines whether or not it should be treated as an
526 -- string literal. This is called by Sem_Ch6.Analyze_Operator_Symbol. If
527 -- True is returned, the argument is converted to a string literal. If
528 -- False is returned, then the argument is treated as an entity reference
529 -- to the operator.
531 function Is_Private_SPARK_Mode (N : Node_Id) return Boolean;
532 -- Determine whether pragma SPARK_Mode appears in the private part of a
533 -- package.
535 function Is_Valid_Assertion_Kind (Nam : Name_Id) return Boolean;
536 -- Returns True if Nam is one of the names recognized as a valid assertion
537 -- kind by the Assertion_Policy pragma. Note that the 'Class cases are
538 -- represented by the corresponding special names Name_uPre, Name_uPost,
539 -- Name_uInvariant, and Name_uType_Invariant (_Pre, _Post, _Invariant,
540 -- and _Type_Invariant).
542 procedure Process_Compilation_Unit_Pragmas (N : Node_Id);
543 -- Called at the start of processing compilation unit N to deal with any
544 -- special issues regarding pragmas. In particular, we have to deal with
545 -- Suppress_All at this stage, since it can appear after the unit instead
546 -- of before (actually we allow it to appear anywhere).
548 procedure Relocate_Pragmas_To_Anonymous_Object
549 (Typ_Decl : Node_Id;
550 Obj_Decl : Node_Id);
551 -- Relocate all pragmas that appear in the visible declarations of task or
552 -- protected type declaration Typ_Decl after the declaration of anonymous
553 -- object Obj_Decl. Table Pragmas_On_Anonymous_Object_OK contains the list
554 -- of candidate pragmas.
556 procedure Relocate_Pragmas_To_Body
557 (Subp_Body : Node_Id;
558 Target_Body : Node_Id := Empty);
559 -- Resocate all pragmas that follow and apply to subprogram body Subp_Body
560 -- to its own declaration list. Candidate pragmas are classified in table
561 -- Pragma_On_Body_Or_Stub_OK. If Target_Body is set, the pragma are moved
562 -- to the declarations of Target_Body. This formal should be set when
563 -- dealing with subprogram body stubs or expression functions.
565 procedure Set_Encoded_Interface_Name (E : Entity_Id; S : Node_Id);
566 -- This routine is used to set an encoded interface name. The node S is
567 -- an N_String_Literal node for the external name to be set, and E is an
568 -- entity whose Interface_Name field is to be set. In the normal case where
569 -- S contains a name that is a valid C identifier, then S is simply set as
570 -- the value of the Interface_Name. Otherwise it is encoded as needed by
571 -- particular operating systems. See the body for details of the encoding.
573 procedure Set_Overflow_Mode (N : Node_Id);
574 -- Sets Sem.Scope_Suppress according to the overflow modes specified in
575 -- the pragma Overflow_Mode passed in argument. This should only be called
576 -- after N has been successfully analyzed.
578 function Test_Case_Arg
579 (Prag : Node_Id;
580 Arg_Nam : Name_Id;
581 From_Aspect : Boolean := False) return Node_Id;
582 -- Obtain argument "Name", "Mode", "Ensures" or "Requires" from Test_Case
583 -- pragma Prag as denoted by Arg_Nam. When From_Aspect is set, an attempt
584 -- is made to retrieve the argument from the corresponding aspect if there
585 -- is one. The returned argument has several formats:
587 -- N_Pragma_Argument_Association if retrieved directly from the pragma
589 -- N_Component_Association if retrieved from the corresponding aspect and
590 -- the argument appears in a named association form.
592 -- An arbitrary expression if retrieved from the corresponding aspect and
593 -- the argument appears in positional form.
595 -- Empty if there is no such argument
597 procedure Validate_Compile_Time_Warning_Errors;
598 -- This routine is called after calling the back end to validate pragmas
599 -- Compile_Time_Error and Compile_Time_Warning for size and alignment
600 -- appropriateness. The reason it is called that late is to take advantage
601 -- of any back-annotation of size and alignment performed by the back end.
603 end Sem_Prag;