Remove some compile time warnings about duplicate definitions.
[official-gcc.git] / gcc / ada / exp_tss.ads
blob1df084fed88df207c423005a19d7f515881c5ac2
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- E X P _ T S S --
6 -- --
7 -- S p e c --
8 -- --
9 -- $Revision: 1.7 $
10 -- --
11 -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
12 -- --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
23 -- --
24 -- GNAT was originally developed by the GNAT team at New York University. --
25 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
26 -- --
27 ------------------------------------------------------------------------------
29 -- Type Support Subprogram (TSS) handling
31 with Types; use Types;
33 package Exp_Tss is
35 -- A type support subprogram (TSS) is an internally generated function or
36 -- procedure that is associated with a particular type. Examples are the
37 -- implicit initialization procedure, and subprograms for the Input and
38 -- Output attributes.
40 -- A given TSS is either generated once at the point of the declaration of
41 -- the type, or it is generated as needed in clients, but only one copy is
42 -- required in any one generated object file. The choice between these two
43 -- possibilities is made on a TSS-by-TSS basis depending on the estimation
44 -- of how likely the TSS is to be used. Initialization procedures fall in
45 -- the first category, for example, since it is likely that any declared
46 -- type will be used in a context requiring initialization, but the stream
47 -- attributes use the second approach, since it is more likely that they
48 -- will not be used at all, or will only be used in one client in any case.
50 -- A TSS is identified by its Chars name, i.e. for a given TSS type, the
51 -- same name is used for all types, e.g. the initialization routine has
52 -- the name _init for all types.
54 -- The TSS's for a given type are stored in an element list associated with
55 -- the type, and referenced from the TSS_Elist field of the N_Freeze_Entity
56 -- node associated with the type (all types that need TSS's always need to
57 -- be explicitly frozen, so the N_Freeze_Entity node always exists).
59 function TSS (Typ : Entity_Id; Nam : Name_Id) return Entity_Id;
60 -- Finds the TSS with the given name associated with the given type. If
61 -- no such TSS exists, then Empty is returned.
63 procedure Set_TSS (Typ : Entity_Id; TSS : Entity_Id);
64 -- This procedure is used to install a newly created TSS. The second
65 -- argument is the entity for such a new TSS. This entity is placed in
66 -- the TSS list for the type given as the first argument, replacing an
67 -- old entry of the same name if one was present. The tree for the body
68 -- of this TSS, which is not analyzed yet, is placed in the actions field
69 -- of the freeze node for the type. All such bodies are inserted into the
70 -- main tree and analyzed at the point at which the freeze node itself is
71 -- is expanded.
73 procedure Copy_TSS (TSS : Entity_Id; Typ : Entity_Id);
74 -- Given an existing TSS for another type (which is already installed,
75 -- analyzed and expanded), install it as the corresponding TSS for Typ.
76 -- Note that this just copies a reference, not the tree. This can also
77 -- be used to initially install a TSS in the case where the subprogram
78 -- for the TSS has already been created and its declaration processed.
80 function Init_Proc (Typ : Entity_Id) return Entity_Id;
81 pragma Inline (Init_Proc);
82 -- Obtains the _init TSS entry for the given type. This function call is
83 -- equivalent to TSS (Typ, Name_uInit). The _init TSS is the procedure
84 -- used to initialize otherwise uninitialized instances of a type. If
85 -- there is no _init TSS, then the type requires no initialization. Note
86 -- that subtypes and implicit types never have an _init TSS since subtype
87 -- objects are always initialized using the initialization procedure for
88 -- the corresponding base type (see Base_Init_Proc function). A special
89 -- case arises for concurrent types. Such types do not themselves have an
90 -- _init TSR, but initialization is required. The initialization procedure
91 -- used is the one fot the corresponding record type (see Base_Init_Proc).
93 function Base_Init_Proc (Typ : Entity_Id) return Entity_Id;
94 -- Obtains the _Init TSS entry from the base type of the entity, and also
95 -- deals with going indirect through the Corresponding_Record_Type field
96 -- for concurrent objects (which are initialized with the initialization
97 -- routine for the corresponding record type). Returns Empty if there is
98 -- no _Init TSS entry for the base type.
100 procedure Set_Init_Proc (Typ : Entity_Id; Init : Entity_Id);
101 pragma Inline (Set_Init_Proc);
102 -- The second argument is the _init TSS to be established for the type
103 -- given as the first argument. Equivalent to Set_TSS (Typ, Init).
105 function Has_Non_Null_Base_Init_Proc (Typ : Entity_Id) return Boolean;
106 -- Returns true if the given type has a defined Base_Init_Proc and
107 -- this init proc is not a null init proc (null init procs occur as
108 -- a result of the processing for Initialize_Scalars. This function
109 -- is used to test for the presence of an Init_Proc in cases where
110 -- a null init proc is considered equivalent to no Init_Proc.
112 end Exp_Tss;