File : sem_prag.ads


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