OSDN Git Service

2007-04-20 Vincent Celier <celier@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / exp_ch9.ads
index c606582..88d0e05 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2004 Free Software Foundation, Inc.          --
+--          Copyright (C) 1992-2007, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -16,8 +16,8 @@
 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
 -- for  more details.  You should have  received  a copy of the GNU General --
 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
--- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
--- MA 02111-1307, USA.                                                      --
+-- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
+-- Boston, MA 02110-1301, USA.                                              --
 --                                                                          --
 -- GNAT was originally developed  by the GNAT team at  New York University. --
 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
 
 --  Expand routines for chapter 9 constructs
 
+with Namet; use Namet;
 with Types; use Types;
 
 package Exp_Ch9 is
 
+   type Subprogram_Protection_Mode is
+     (Dispatching_Mode,
+      Protected_Mode,
+      Unprotected_Mode);
+   --  This type is used to distinguish the different protection modes of a
+   --  protected subprogram.
+
    procedure Add_Discriminal_Declarations
      (Decls : List_Id;
       Typ   : Entity_Id;
@@ -70,11 +78,7 @@ package Exp_Ch9 is
    --  (other than allocators to tasks) this routine ensures that an activation
    --  chain has been declared in the appropriate scope, building the required
    --  declaration for the chain variable if not. The name of this variable
-   --  is always _Chain and it is accessed by name. This procedure also adds
-   --  an appropriate call to Activate_Tasks to activate the tasks for this
-   --  activation chain. It does not however deal with the call needed in the
-   --  case of allocators to Expunge_Unactivated_Tasks, this is separately
-   --  handled in the Expand_Task_Allocator routine.
+   --  is always _Chain and it is accessed by name.
 
    function Build_Call_With_Task (N : Node_Id; E : Entity_Id) return Node_Id;
    --  N is a node representing the name of a task or an access to a task.
@@ -83,6 +87,14 @@ package Exp_Ch9 is
    --  Task_Id of the associated task as the parameter. The caller is
    --  responsible for analyzing and resolving the resulting tree.
 
+   function Build_Corresponding_Record
+     (N    : Node_Id;
+      Ctyp : Node_Id;
+      Loc  : Source_Ptr) return Node_Id;
+   --  Common to tasks and protected types. Copy discriminant specifications,
+   --  build record declaration. N is the type declaration, Ctyp is the
+   --  concurrent entity (task type or protected type).
+
    procedure Build_Master_Entity (E : Entity_Id);
    --  Given an entity E for the declaration of an object containing tasks
    --  or of a type declaration for an allocator whose designated type is a
@@ -102,10 +114,9 @@ package Exp_Ch9 is
    --  declarative part.
 
    function Build_Protected_Sub_Specification
-     (N           : Node_Id;
-      Prottyp     : Entity_Id;
-      Unprotected : Boolean := False)
-      return        Node_Id;
+     (N       : Node_Id;
+      Prottyp : Entity_Id;
+      Mode    : Subprogram_Protection_Mode) return Node_Id;
    --  Build specification for protected subprogram. This is called when
    --  expanding a protected type, and also when expanding the declaration for
    --  an Access_To_Protected_Subprogram type. In the latter case, Prottyp is
@@ -214,7 +225,7 @@ package Exp_Ch9 is
    --  routine to make sure Complete_Master is called on exit).
 
    procedure Expand_Access_Protected_Subprogram_Type (N : Node_Id);
-   --  Build Equivalent_Type for an Access_to_protected_Subprogram.
+   --  Build Equivalent_Type for an Access_to_protected_Subprogram
 
    procedure Expand_Accept_Declarations (N : Node_Id; Ent : Entity_Id);
    --  Expand declarations required for accept statement. See bodies of
@@ -248,16 +259,14 @@ package Exp_Ch9 is
    procedure Expand_N_Protected_Body             (N : Node_Id);
 
    procedure Expand_N_Protected_Type_Declaration (N : Node_Id);
-   --  Expands protected type declarations. This results, among
-   --  other things, in the declaration of a record type for the
-   --  representation of protected objects and (if there are entries)
-   --  in an entry service procedure. The Protection value used by
-   --  the GNARL to control the object will always be the first
-   --  field of the record, and the entry service procedure spec
-   --  (if it exists) will always immediately follow the record
-   --  declaration. This allows these two nodes to be found from
-   --  the type using Corresponding_Record, without benefit of
-   --  of further attributes.
+   --  Expands protected type declarations. This results, among other things,
+   --  in the declaration of a record type for the representation of protected
+   --  objects and (if there are entries) in an entry service procedure. The
+   --  Protection value used by the GNARL to control the object will always be
+   --  the first field of the record, and the entry service procedure spec (if
+   --  it exists) will always immediately follow the record declaration. This
+   --  allows these two nodes to be found from the type, without benefit of
+   --  further attributes, using Corresponding_Record.
 
    procedure Expand_N_Requeue_Statement          (N : Node_Id);
    procedure Expand_N_Selective_Accept           (N : Node_Id);
@@ -305,13 +314,21 @@ package Exp_Ch9 is
    --  protected type.
 
    procedure Set_Privals
-      (Dec : Node_Id;
-       Op  : Node_Id;
-       Loc : Source_Ptr);
+      (Dec           : Node_Id;
+       Op            : Node_Id;
+       Loc           : Source_Ptr;
+       After_Barrier : Boolean := False);
    --  Associates a new set of privals (placeholders for later access to
    --  private components of protected objects) with the private object
    --  declarations of a protected object. These will be used to expand
    --  the references to private objects in the next protected
    --  subprogram or entry body to be expanded.
+   --
+   --  The flag After_Barrier indicates whether this is called after building
+   --  the barrier function for an entry body. This flag determines whether
+   --  the privals should have source names (which simplifies debugging) or
+   --  internally generated names. Entry barriers contain no debuggable code,
+   --  and there may be visibility conflicts between an entry index and a
+   --  a prival, so  privals for barrier function have internal names.
 
 end Exp_Ch9;