Remove some compile time warnings about duplicate definitions.
[official-gcc.git] / gcc / ada / sem_ch13.ads
blob5afe5adb2086109930e55df70e1faef1db48775d
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S E M _ C H 1 3 --
6 -- --
7 -- S p e c --
8 -- --
9 -- $Revision: 1.39 $
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 with Snames; use Snames;
30 with Types; use Types;
31 with Uintp; use Uintp;
33 package Sem_Ch13 is
34 procedure Analyze_At_Clause (N : Node_Id);
35 procedure Analyze_Attribute_Definition_Clause (N : Node_Id);
36 procedure Analyze_Enumeration_Representation_Clause (N : Node_Id);
37 procedure Analyze_Free_Statement (N : Node_Id);
38 procedure Analyze_Record_Representation_Clause (N : Node_Id);
39 procedure Analyze_Code_Statement (N : Node_Id);
41 procedure Initialize;
42 -- Initialize internal tables for new compilation
44 procedure Set_Enum_Esize (T : Entity_Id);
45 -- This routine sets the Esize field for an enumeration type T, based
46 -- on the current representation information available for T. Note that
47 -- the setting of the RM_Size field is not affected. This routine also
48 -- initializes the alignment field to zero.
50 function Minimum_Size
51 (T : Entity_Id;
52 Biased : Boolean := False)
53 return Nat;
54 -- Given a primitive type, determines the minimum number of bits required
55 -- to represent all values of the type. This function may not be called
56 -- with any other types. If the flag Biased is set True, then the minimum
57 -- size calculation that biased representation is used in the case of a
58 -- discrete type, e.g. the range 7..8 gives a minimum size of 4 with
59 -- Biased set to False, and 1 with Biased set to True. Note that the
60 -- biased parameter only has an effect if the type is not biased, it
61 -- causes Minimum_Size to indicate the minimum size of an object with
62 -- the given type, of the size the type would have if it were biased. If
63 -- the type is already biased, then Minimum_Size returns the biased size,
64 -- regardless of the setting of Biased. Also, fixed-point types are never
65 -- biased in the current implementation.
67 procedure Check_Size
68 (N : Node_Id;
69 T : Entity_Id;
70 Siz : Uint;
71 Biased : out Boolean);
72 -- Called when size Siz is specified for subtype T. This subprogram checks
73 -- that the size is appropriate, posting errors on node N as required.
74 -- For non-elementary types, a check is only made if an explicit size
75 -- has been given for the type (and the specified size must match). The
76 -- parameter Biased is set False if the size specified did not require
77 -- the use of biased representation, and True if biased representation
78 -- was required to meet the size requirement. Note that Biased is only
79 -- set if the type is not currently biased, but biasing it is the only
80 -- way to meet the requirement. If the type is currently biased, then
81 -- this biased size is used in the initial check, and Biased is False.
83 function Get_Rep_Pragma (E : Entity_Id; Nam : Name_Id) return Node_Id;
84 -- Searches the Rep_Item chain for the given entity E, for an instance
85 -- of a representation pragma with the given name Nam. If found then
86 -- the value returned is the N_Pragma node, otherwise Empty is returned.
88 function Get_Attribute_Definition_Clause
89 (E : Entity_Id;
90 Id : Attribute_Id)
91 return Node_Id;
92 -- Searches the Rep_Item chain for a given entity E, for an instance
93 -- of an attribute definition clause with the given attibute Id Id. If
94 -- found, the value returned is the N_Attribute_Definition_Clause node,
95 -- otherwise Empty is returned.
97 procedure Record_Rep_Item (T : Entity_Id; N : Node_Id);
98 -- N is the node for either a representation pragma or an attribute
99 -- definition clause that applies to type T. This procedure links
100 -- the node N onto the Rep_Item chain for the type T.
102 function Rep_Item_Too_Early
103 (T : Entity_Id;
104 N : Node_Id)
105 return Boolean;
106 -- Called at the start of processing a representation clause or a
107 -- representation pragma. Used to check that the representation item
108 -- is not being applied to an incompleted type or to a generic formal
109 -- type or a type derived from a generic formal type. Returns False if
110 -- no such error occurs. If this error does occur, appropriate error
111 -- messages are posted on node N, and True is returned.
113 function Rep_Item_Too_Late
114 (T : Entity_Id;
115 N : Node_Id;
116 FOnly : Boolean := False)
117 return Boolean;
118 -- Called at the start of processing a representation clause or a
119 -- representation pragma. Used to check that a representation item
120 -- for entity T does not appear too late (according to the rules in
121 -- RM 13.1(9) and RM 13.1(10)). N is the associated node, which in
122 -- the pragma case is the pragma or representation clause itself, used
123 -- for placing error messages if the item is too late.
125 -- Fonly is a flag that causes only the freezing rule (para 9) to be
126 -- applied, and the tests of para 10 are skipped. This is appropriate
127 -- for both subtype related attributes (Alignment and Size) and for
128 -- stream attributes, which, although certainly not subtype related
129 -- attributes, clearly should not be subject to the para 10 restrictions
130 -- (see AI95-00137). Similarly, we also skip the para 10 restrictions for
131 -- the Storage_Size case where they also clearly do not apply.
133 -- If the rep item is too late, an appropriate message is output and
134 -- True is returned, which is a signal that the caller should abandon
135 -- processing for the item. If the item is not too late, then False
136 -- is returned, and the caller can continue processing the item.
138 -- If no error is detected, this call also as a side effect links the
139 -- representation item onto the head of the representation item chain
140 -- (referenced by the First_Rep_Item field of the entity).
142 -- Note: Rep_Item_Too_Late must be called with the underlying type in
143 -- the case of a private or incomplete type. The protocol is to first
144 -- check for Rep_Item_Too_Early using the initial entity, then take the
145 -- underlying type, then call Rep_Item_Too_Late on the result.
147 function Same_Representation (Typ1, Typ2 : Entity_Id) return Boolean;
148 -- Given two types, where the two types are related by possible derivation,
149 -- determines if the two types have the same representation, or different
150 -- representations, requiring the special processing for representation
151 -- change. A False result is possible only for array, enumeration or
152 -- record types.
154 procedure Validate_Unchecked_Conversion
155 (N : Node_Id;
156 Act_Unit : Entity_Id);
157 -- Validate a call to unchecked conversion. N is the node for the actual
158 -- instantiation, which is used only for error messages. Act_Unit is the
159 -- entity for the instantiation, from which the actual types etc for this
160 -- instantiation can be determined. This procedure makes an entry in a
161 -- table and/or generates an N_Validate_Unchecked_Conversion node. The
162 -- actual checking is done in Validate_Unchecked_Conversions or in the
163 -- back end as required.
165 procedure Validate_Unchecked_Conversions;
166 -- This routine is called after calling the backend to validate
167 -- unchecked conversions for size and alignment appropriateness.
168 -- The reason it is called that late is to take advantage of any
169 -- back-annotation of size and alignment performed by the backend.
171 end Sem_Ch13;