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