annotate gcc/ada/sem_attr.ads @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT COMPILER COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- S E M _ A T T R --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
9 -- Copyright (C) 1992-2018, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
17 -- --
kono
parents:
diff changeset
18 -- You should have received a copy of the GNU General Public License along --
kono
parents:
diff changeset
19 -- with this program; see file COPYING3. If not see --
kono
parents:
diff changeset
20 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
24 -- --
kono
parents:
diff changeset
25 ------------------------------------------------------------------------------
kono
parents:
diff changeset
26
kono
parents:
diff changeset
27 -- Attribute handling is isolated in a separate package to ease the addition
kono
parents:
diff changeset
28 -- of implementation defined attributes. Logically this processing belongs
kono
parents:
diff changeset
29 -- in chapter 4. See Sem_Ch4 for a description of the relation of the
kono
parents:
diff changeset
30 -- Analyze and Resolve routines for expression components.
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 -- This spec also documents all GNAT implementation defined pragmas
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 with Exp_Tss; use Exp_Tss;
kono
parents:
diff changeset
35 with Namet; use Namet;
kono
parents:
diff changeset
36 with Snames; use Snames;
kono
parents:
diff changeset
37 with Types; use Types;
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 package Sem_Attr is
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 -----------------------------------------
kono
parents:
diff changeset
42 -- Implementation Dependent Attributes --
kono
parents:
diff changeset
43 -----------------------------------------
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 -- This section describes the implementation dependent attributes provided
kono
parents:
diff changeset
46 -- in GNAT, as well as constructing an array of flags indicating which
kono
parents:
diff changeset
47 -- attributes these are.
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 Attribute_Impl_Def : constant Attribute_Class_Array :=
kono
parents:
diff changeset
50 Attribute_Class_Array'(
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 ------------------
kono
parents:
diff changeset
53 -- Abort_Signal --
kono
parents:
diff changeset
54 ------------------
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 Attribute_Abort_Signal => True,
kono
parents:
diff changeset
57 -- Standard'Abort_Signal (Standard is the only allowed prefix) provides
kono
parents:
diff changeset
58 -- the entity for the special exception used to signal task abort or
kono
parents:
diff changeset
59 -- asynchronous transfer of control. Normally this attribute should only
kono
parents:
diff changeset
60 -- be used in the tasking runtime (it is highly peculiar, and completely
kono
parents:
diff changeset
61 -- outside the normal semantics of Ada, for a user program to intercept
kono
parents:
diff changeset
62 -- the abort exception).
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 ------------------
kono
parents:
diff changeset
65 -- Address_Size --
kono
parents:
diff changeset
66 ------------------
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 Attribute_Address_Size => True,
kono
parents:
diff changeset
69 -- Standard'Address_Size (Standard is the only allowed prefix) is
kono
parents:
diff changeset
70 -- a static constant giving the number of bits in an Address. It
kono
parents:
diff changeset
71 -- is used primarily for constructing the definition of Memory_Size
kono
parents:
diff changeset
72 -- in package Standard, but may be freely used in user programs.
kono
parents:
diff changeset
73 -- This is a static attribute.
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 ---------------
kono
parents:
diff changeset
76 -- Asm_Input --
kono
parents:
diff changeset
77 ---------------
kono
parents:
diff changeset
78
kono
parents:
diff changeset
79 Attribute_Asm_Input => True,
kono
parents:
diff changeset
80 -- Used only in conjunction with the Asm subprograms in package
kono
parents:
diff changeset
81 -- Machine_Code to construct machine instructions. See documentation
kono
parents:
diff changeset
82 -- in package Machine_Code in file s-maccod.ads.
kono
parents:
diff changeset
83
kono
parents:
diff changeset
84 ----------------
kono
parents:
diff changeset
85 -- Asm_Output --
kono
parents:
diff changeset
86 ----------------
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 Attribute_Asm_Output => True,
kono
parents:
diff changeset
89 -- Used only in conjunction with the Asm subprograms in package
kono
parents:
diff changeset
90 -- Machine_Code to construct machine instructions. See documentation
kono
parents:
diff changeset
91 -- in package Machine_Code in file s-maccod.ads.
kono
parents:
diff changeset
92
kono
parents:
diff changeset
93 ---------
kono
parents:
diff changeset
94 -- Bit --
kono
parents:
diff changeset
95 ---------
kono
parents:
diff changeset
96
kono
parents:
diff changeset
97 Attribute_Bit => True,
kono
parents:
diff changeset
98 -- Obj'Bit, where Obj is any object, yields the bit offset within the
kono
parents:
diff changeset
99 -- storage unit (byte) that contains the first bit of storage allocated
kono
parents:
diff changeset
100 -- for the object. The attribute value is of type Universal_Integer,
kono
parents:
diff changeset
101 -- and is always a non-negative number not exceeding the value of
kono
parents:
diff changeset
102 -- System.Storage_Unit.
kono
parents:
diff changeset
103 --
kono
parents:
diff changeset
104 -- For an object that is a variable or a constant allocated in a
kono
parents:
diff changeset
105 -- register, the value is zero. (The use of this attribute does not
kono
parents:
diff changeset
106 -- force the allocation of a variable to memory).
kono
parents:
diff changeset
107 --
kono
parents:
diff changeset
108 -- For an object that is a formal parameter, this attribute applies to
kono
parents:
diff changeset
109 -- either the matching actual parameter or to a copy of the matching
kono
parents:
diff changeset
110 -- actual parameter.
kono
parents:
diff changeset
111 --
kono
parents:
diff changeset
112 -- For an access object the value is zero. Note that Obj.all'Bit is
kono
parents:
diff changeset
113 -- subject to an Access_Check for the designated object. Similarly
kono
parents:
diff changeset
114 -- for a record component X.C'Bit is subject to a discriminant check
kono
parents:
diff changeset
115 -- and X(I).Bit and X(I1..I2)'Bit are subject to index checks.
kono
parents:
diff changeset
116 --
kono
parents:
diff changeset
117 -- This attribute is designed to be compatible with the DEC Ada
kono
parents:
diff changeset
118 -- definition and implementation of the Bit attribute.
kono
parents:
diff changeset
119
kono
parents:
diff changeset
120 ------------------
kono
parents:
diff changeset
121 -- Code_Address --
kono
parents:
diff changeset
122 ------------------
kono
parents:
diff changeset
123
kono
parents:
diff changeset
124 Attribute_Code_Address => True,
kono
parents:
diff changeset
125 -- The reference subp'Code_Address, where subp is a subprogram entity,
kono
parents:
diff changeset
126 -- gives the address of the first generated instruction for the sub-
kono
parents:
diff changeset
127 -- program. This is often, but not always the same as the 'Address
kono
parents:
diff changeset
128 -- value, which is the address to be used in a call. The differences
kono
parents:
diff changeset
129 -- occur in the case of a nested procedure (where Address yields the
kono
parents:
diff changeset
130 -- address of the trampoline code used to load the static link), and on
kono
parents:
diff changeset
131 -- some systems which use procedure descriptors (in which case Address
kono
parents:
diff changeset
132 -- yields the address of the descriptor).
kono
parents:
diff changeset
133
kono
parents:
diff changeset
134 -----------------------
kono
parents:
diff changeset
135 -- Default_Bit_Order --
kono
parents:
diff changeset
136 -----------------------
kono
parents:
diff changeset
137
kono
parents:
diff changeset
138 Attribute_Default_Bit_Order => True,
kono
parents:
diff changeset
139 -- Standard'Default_Bit_Order (Standard is the only permissible prefix)
kono
parents:
diff changeset
140 -- provides the value System.Default_Bit_Order as a Pos value (0 for
kono
parents:
diff changeset
141 -- High_Order_First, 1 for Low_Order_First). This is used to construct
kono
parents:
diff changeset
142 -- the definition of Default_Bit_Order in package System. This is a
kono
parents:
diff changeset
143 -- static attribute.
kono
parents:
diff changeset
144
kono
parents:
diff changeset
145 ----------------------------------
kono
parents:
diff changeset
146 -- Default_Scalar_Storage_Order --
kono
parents:
diff changeset
147 ----------------------------------
kono
parents:
diff changeset
148
kono
parents:
diff changeset
149 Attribute_Default_Scalar_Storage_Order => True,
kono
parents:
diff changeset
150 -- Standard'Default_Scalar_Storage_Order (Standard is the
kono
parents:
diff changeset
151 -- only permissible prefix) provides the current value of the
kono
parents:
diff changeset
152 -- default scalar storage order (as specified using pragma
kono
parents:
diff changeset
153 -- Default_Scalar_Storage_Order, or equal to Default_Bit_Order if
kono
parents:
diff changeset
154 -- unspecified) as a System.Bit_Order value. This is a static attribute.
kono
parents:
diff changeset
155
kono
parents:
diff changeset
156 -----------
kono
parents:
diff changeset
157 -- Deref --
kono
parents:
diff changeset
158 -----------
kono
parents:
diff changeset
159
kono
parents:
diff changeset
160 Attribute_Deref => True,
kono
parents:
diff changeset
161 -- typ'Deref (expr) is valid only if expr is of type System'Address.
kono
parents:
diff changeset
162 -- The result is an object of type typ that is obtained by treating the
kono
parents:
diff changeset
163 -- address as an access-to-typ value that points to the result. It is
kono
parents:
diff changeset
164 -- basically equivalent to (atyp!expr).all where atyp is an access type
kono
parents:
diff changeset
165 -- for the type.
kono
parents:
diff changeset
166
kono
parents:
diff changeset
167 ---------------
kono
parents:
diff changeset
168 -- Elab_Body --
kono
parents:
diff changeset
169 ---------------
kono
parents:
diff changeset
170
kono
parents:
diff changeset
171 Attribute_Elab_Body => True,
kono
parents:
diff changeset
172 -- This attribute can only be applied to a program unit name. It
kono
parents:
diff changeset
173 -- returns the entity for the corresponding elaboration procedure for
kono
parents:
diff changeset
174 -- elaborating the body of the referenced unit. This is used in the main
kono
parents:
diff changeset
175 -- generated elaboration procedure by the binder, and is not normally
kono
parents:
diff changeset
176 -- used in any other context, but there may be specialized situations in
kono
parents:
diff changeset
177 -- which it is useful to be able to call this elaboration procedure from
kono
parents:
diff changeset
178 -- Ada code, e.g. if it is necessary to do selective reelaboration to
kono
parents:
diff changeset
179 -- fix some error.
kono
parents:
diff changeset
180
kono
parents:
diff changeset
181 --------------------
kono
parents:
diff changeset
182 -- Elab_Subp_Body --
kono
parents:
diff changeset
183 --------------------
kono
parents:
diff changeset
184
kono
parents:
diff changeset
185 Attribute_Elab_Subp_Body => True,
kono
parents:
diff changeset
186 -- This attribute can only be applied to a library level subprogram
kono
parents:
diff changeset
187 -- name and is only relevant in CodePeer mode. It returns the entity
kono
parents:
diff changeset
188 -- for the corresponding elaboration procedure for elaborating the body
kono
parents:
diff changeset
189 -- of the referenced subprogram unit. This is used in the main generated
kono
parents:
diff changeset
190 -- elaboration procedure by the binder in CodePeer mode only.
kono
parents:
diff changeset
191
kono
parents:
diff changeset
192 ---------------
kono
parents:
diff changeset
193 -- Elab_Spec --
kono
parents:
diff changeset
194 ---------------
kono
parents:
diff changeset
195
kono
parents:
diff changeset
196 Attribute_Elab_Spec => True,
kono
parents:
diff changeset
197 -- This attribute can only be applied to a program unit name. It
kono
parents:
diff changeset
198 -- returns the entity for the corresponding elaboration procedure for
kono
parents:
diff changeset
199 -- elaborating the spec of the referenced unit. This is used in the main
kono
parents:
diff changeset
200 -- generated elaboration procedure by the binder, and is not normally
kono
parents:
diff changeset
201 -- used in any other context, but there may be specialized situations in
kono
parents:
diff changeset
202 -- which it is useful to be able to call this elaboration procedure from
kono
parents:
diff changeset
203 -- Ada code, e.g. if it is necessary to do selective reelaboration to
kono
parents:
diff changeset
204 -- fix some error.
kono
parents:
diff changeset
205
kono
parents:
diff changeset
206 ----------------
kono
parents:
diff changeset
207 -- Elaborated --
kono
parents:
diff changeset
208 ----------------
kono
parents:
diff changeset
209
kono
parents:
diff changeset
210 Attribute_Elaborated => True,
kono
parents:
diff changeset
211 -- Lunit'Elaborated, where Lunit is a library unit, yields a boolean
kono
parents:
diff changeset
212 -- value indicating whether or not the body of the designated library
kono
parents:
diff changeset
213 -- unit has been elaborated yet.
kono
parents:
diff changeset
214
kono
parents:
diff changeset
215 --------------
kono
parents:
diff changeset
216 -- Enum_Rep --
kono
parents:
diff changeset
217 --------------
kono
parents:
diff changeset
218
kono
parents:
diff changeset
219 Attribute_Enum_Rep => True,
kono
parents:
diff changeset
220 -- For every enumeration subtype S, S'Enum_Rep denotes a function
kono
parents:
diff changeset
221 -- with the following specification:
kono
parents:
diff changeset
222 --
kono
parents:
diff changeset
223 -- function S'Enum_Rep (Arg : S'Base) return universal_integer;
kono
parents:
diff changeset
224 --
kono
parents:
diff changeset
225 -- The function returns the representation value for the given
kono
parents:
diff changeset
226 -- enumeration value. This will be equal to the 'Pos value in the
kono
parents:
diff changeset
227 -- absence of an enumeration representation clause. This is a static
kono
parents:
diff changeset
228 -- attribute (i.e. the result is static if the argument is static).
kono
parents:
diff changeset
229
kono
parents:
diff changeset
230 --------------
kono
parents:
diff changeset
231 -- Enum_Val --
kono
parents:
diff changeset
232 --------------
kono
parents:
diff changeset
233
kono
parents:
diff changeset
234 Attribute_Enum_Val => True,
kono
parents:
diff changeset
235 -- For every enumeration subtype S, S'Enum_Val denotes a function with
kono
parents:
diff changeset
236 -- the following specification:
kono
parents:
diff changeset
237 --
kono
parents:
diff changeset
238 -- function S'Enum_Val (Arg : universal_integer) return S'Base;
kono
parents:
diff changeset
239 --
kono
parents:
diff changeset
240 -- This function performs the inverse transformation to Enum_Rep. Given
kono
parents:
diff changeset
241 -- a representation value for the type, it returns the corresponding
kono
parents:
diff changeset
242 -- enumeration value. Constraint_Error is raised if no value of the
kono
parents:
diff changeset
243 -- enumeration type corresponds to the given integer value.
kono
parents:
diff changeset
244
kono
parents:
diff changeset
245 -----------------------
kono
parents:
diff changeset
246 -- Finalization_Size --
kono
parents:
diff changeset
247 -----------------------
kono
parents:
diff changeset
248
kono
parents:
diff changeset
249 Attribute_Finalization_Size => True,
kono
parents:
diff changeset
250 -- For every object or non-class-wide-type, Finalization_Size returns
kono
parents:
diff changeset
251 -- the size of the hidden header used for finalization purposes as if
kono
parents:
diff changeset
252 -- the object or type was allocated on the heap. The size of the header
kono
parents:
diff changeset
253 -- does take into account any extra padding due to alignment issues.
kono
parents:
diff changeset
254
kono
parents:
diff changeset
255 -----------------
kono
parents:
diff changeset
256 -- Fixed_Value --
kono
parents:
diff changeset
257 -----------------
kono
parents:
diff changeset
258
kono
parents:
diff changeset
259 Attribute_Fixed_Value => True,
kono
parents:
diff changeset
260 -- For every fixed-point type S, S'Fixed_Value denotes a function
kono
parents:
diff changeset
261 -- with the following specification:
kono
parents:
diff changeset
262 --
kono
parents:
diff changeset
263 -- function S'Fixed_Value (Arg : universal_integer) return S;
kono
parents:
diff changeset
264 --
kono
parents:
diff changeset
265 -- The value returned is the fixed-point value V such that
kono
parents:
diff changeset
266 --
kono
parents:
diff changeset
267 -- V = Arg * S'Small
kono
parents:
diff changeset
268 --
kono
parents:
diff changeset
269 -- The effect is thus equivalent to first converting the argument to
kono
parents:
diff changeset
270 -- the integer type used to represent S, and then doing an unchecked
kono
parents:
diff changeset
271 -- conversion to the fixed-point type. This attribute is primarily
kono
parents:
diff changeset
272 -- intended for use in implementation of the input-output functions
kono
parents:
diff changeset
273 -- for fixed-point values.
kono
parents:
diff changeset
274
kono
parents:
diff changeset
275 -----------------------
kono
parents:
diff changeset
276 -- Has_Discriminants --
kono
parents:
diff changeset
277 -----------------------
kono
parents:
diff changeset
278
kono
parents:
diff changeset
279 Attribute_Has_Discriminants => True,
kono
parents:
diff changeset
280 -- Gtyp'Has_Discriminants, where Gtyp is a generic formal type, yields
kono
parents:
diff changeset
281 -- a Boolean value indicating whether or not the actual instantiation
kono
parents:
diff changeset
282 -- type has discriminants.
kono
parents:
diff changeset
283
kono
parents:
diff changeset
284 ---------
kono
parents:
diff changeset
285 -- Img --
kono
parents:
diff changeset
286 ---------
kono
parents:
diff changeset
287
kono
parents:
diff changeset
288 Attribute_Img => True,
kono
parents:
diff changeset
289 -- The 'Img function is defined for any prefix, P, that denotes an
kono
parents:
diff changeset
290 -- object of scalar type T. P'Img is equivalent to T'Image (P). This
kono
parents:
diff changeset
291 -- is convenient for debugging. For example:
kono
parents:
diff changeset
292 --
kono
parents:
diff changeset
293 -- Put_Line ("X = " & X'Img);
kono
parents:
diff changeset
294 --
kono
parents:
diff changeset
295 -- has the same meaning as the more verbose:
kono
parents:
diff changeset
296 --
kono
parents:
diff changeset
297 -- Put_Line ("X = " & Temperature_Type'Image (X));
kono
parents:
diff changeset
298 --
kono
parents:
diff changeset
299 -- where Temperature_Type is the subtype of the object X.
kono
parents:
diff changeset
300
kono
parents:
diff changeset
301 -------------------
kono
parents:
diff changeset
302 -- Integer_Value --
kono
parents:
diff changeset
303 -------------------
kono
parents:
diff changeset
304
kono
parents:
diff changeset
305 Attribute_Integer_Value => True,
kono
parents:
diff changeset
306 -- For every integer type S, S'Integer_Value denotes a function
kono
parents:
diff changeset
307 -- with the following specification:
kono
parents:
diff changeset
308 --
kono
parents:
diff changeset
309 -- function S'Integer_Value (Arg : universal_fixed) return S;
kono
parents:
diff changeset
310 --
kono
parents:
diff changeset
311 -- The value returned is the integer value V, such that
kono
parents:
diff changeset
312 --
kono
parents:
diff changeset
313 -- Arg = V * fixed-type'Small
kono
parents:
diff changeset
314 --
kono
parents:
diff changeset
315 -- The effect is thus equivalent to first doing an unchecked convert
kono
parents:
diff changeset
316 -- from the fixed-point type to its corresponding implementation type,
kono
parents:
diff changeset
317 -- and then converting the result to the target integer type. This
kono
parents:
diff changeset
318 -- attribute is primarily intended for use in implementation of the
kono
parents:
diff changeset
319 -- standard input-output functions for fixed-point values.
kono
parents:
diff changeset
320
kono
parents:
diff changeset
321 Attribute_Invalid_Value => True,
kono
parents:
diff changeset
322 -- For every scalar type, S'Invalid_Value designates an undefined value
kono
parents:
diff changeset
323 -- of the type. If possible this value is an invalid value, and in fact
kono
parents:
diff changeset
324 -- is identical to the value that would be set if Initialize_Scalars
kono
parents:
diff changeset
325 -- mode were in effect (including the behavior of its value on
kono
parents:
diff changeset
326 -- environment variables or binder switches). The intended use is to
kono
parents:
diff changeset
327 -- set a value where initialization is required (e.g. as a result of the
kono
parents:
diff changeset
328 -- coding standards in use), but logically no initialization is needed,
kono
parents:
diff changeset
329 -- and the value should never be accessed.
kono
parents:
diff changeset
330
kono
parents:
diff changeset
331 Attribute_Loop_Entry => True,
kono
parents:
diff changeset
332 -- For every object of a non-limited type, S'Loop_Entry [(Loop_Name)]
kono
parents:
diff changeset
333 -- denotes the constant value of prefix S at the point of entry into the
kono
parents:
diff changeset
334 -- related loop. The type of the attribute is the type of the prefix.
kono
parents:
diff changeset
335
kono
parents:
diff changeset
336 ------------------
kono
parents:
diff changeset
337 -- Machine_Size --
kono
parents:
diff changeset
338 ------------------
kono
parents:
diff changeset
339
kono
parents:
diff changeset
340 Attribute_Machine_Size => True,
kono
parents:
diff changeset
341 -- This attribute is identical to the Object_Size attribute. It is
kono
parents:
diff changeset
342 -- provided for compatibility with the DEC attribute of this name.
kono
parents:
diff changeset
343
kono
parents:
diff changeset
344 -----------------------
kono
parents:
diff changeset
345 -- Maximum_Alignment --
kono
parents:
diff changeset
346 -----------------------
kono
parents:
diff changeset
347
kono
parents:
diff changeset
348 Attribute_Maximum_Alignment => True,
kono
parents:
diff changeset
349 -- Standard'Maximum_Alignment (Standard is the only permissible prefix)
kono
parents:
diff changeset
350 -- provides the maximum useful alignment value for the target. This is a
kono
parents:
diff changeset
351 -- static value that can be used to specify the alignment for an object,
kono
parents:
diff changeset
352 -- guaranteeing that it is properly aligned in all cases. The time this
kono
parents:
diff changeset
353 -- is useful is when an external object is imported and its alignment
kono
parents:
diff changeset
354 -- requirements are unknown. This is a static attribute.
kono
parents:
diff changeset
355
kono
parents:
diff changeset
356 --------------------
kono
parents:
diff changeset
357 -- Mechanism_Code --
kono
parents:
diff changeset
358 --------------------
kono
parents:
diff changeset
359
kono
parents:
diff changeset
360 Attribute_Mechanism_Code => True,
kono
parents:
diff changeset
361 -- function'Mechanism_Code yields an integer code for the mechanism
kono
parents:
diff changeset
362 -- used for the result of function, and subprogram'Mechanism_Code (n)
kono
parents:
diff changeset
363 -- yields the mechanism used for formal parameter number n (a static
kono
parents:
diff changeset
364 -- integer value, 1 = first parameter). The code returned is:
kono
parents:
diff changeset
365 --
kono
parents:
diff changeset
366 -- 1 = by copy (value)
kono
parents:
diff changeset
367 -- 2 = by reference
kono
parents:
diff changeset
368 -- 3 = by descriptor (default descriptor type)
kono
parents:
diff changeset
369 -- 4 = by descriptor (UBS unaligned bit string)
kono
parents:
diff changeset
370 -- 5 = by descriptor (UBSB aligned bit string with arbitrary bounds)
kono
parents:
diff changeset
371 -- 6 = by descriptor (UBA unaligned bit array)
kono
parents:
diff changeset
372 -- 7 = by descriptor (S string, also scalar access type parameter)
kono
parents:
diff changeset
373 -- 8 = by descriptor (SB string with arbitrary bounds)
kono
parents:
diff changeset
374 -- 9 = by descriptor (A contiguous array)
kono
parents:
diff changeset
375 -- 10 = by descriptor (NCA non-contiguous array)
kono
parents:
diff changeset
376
kono
parents:
diff changeset
377 --------------------
kono
parents:
diff changeset
378 -- Null_Parameter --
kono
parents:
diff changeset
379 --------------------
kono
parents:
diff changeset
380
kono
parents:
diff changeset
381 Attribute_Null_Parameter => True,
kono
parents:
diff changeset
382 -- A reference T'Null_Parameter denotes an (imaginary) object of type
kono
parents:
diff changeset
383 -- or subtype T allocated at (machine) address zero. The attribute is
kono
parents:
diff changeset
384 -- allowed only as the default expression of a formal parameter, or
kono
parents:
diff changeset
385 -- as an actual expression of a subprogram call. In either case, the
kono
parents:
diff changeset
386 -- subprogram must be imported.
kono
parents:
diff changeset
387 --
kono
parents:
diff changeset
388 -- The identity of the object is represented by the address zero in
kono
parents:
diff changeset
389 -- the argument list, independent of the passing mechanism (explicit
kono
parents:
diff changeset
390 -- or default).
kono
parents:
diff changeset
391 --
kono
parents:
diff changeset
392 -- The reason that this capability is needed is that for a record or
kono
parents:
diff changeset
393 -- other composite object passed by reference, there is no other way
kono
parents:
diff changeset
394 -- of specifying that a zero address should be passed.
kono
parents:
diff changeset
395
kono
parents:
diff changeset
396 -----------------
kono
parents:
diff changeset
397 -- Object_Size --
kono
parents:
diff changeset
398 -----------------
kono
parents:
diff changeset
399
kono
parents:
diff changeset
400 Attribute_Object_Size => True,
kono
parents:
diff changeset
401 -- Type'Object_Size is the same as Type'Size for all types except
kono
parents:
diff changeset
402 -- fixed-point types and discrete types. For fixed-point types and
kono
parents:
diff changeset
403 -- discrete types, this attribute gives the size used for default
kono
parents:
diff changeset
404 -- allocation of objects and components of the size. See section in
kono
parents:
diff changeset
405 -- Einfo ("Handling of Type'Size values") for further details.
kono
parents:
diff changeset
406
kono
parents:
diff changeset
407 -------------------------
kono
parents:
diff changeset
408 -- Passed_By_Reference --
kono
parents:
diff changeset
409 -------------------------
kono
parents:
diff changeset
410
kono
parents:
diff changeset
411 Attribute_Passed_By_Reference => True,
kono
parents:
diff changeset
412 -- T'Passed_By_Reference for any subtype T returns a boolean value that
kono
parents:
diff changeset
413 -- is true if the type is normally passed by reference and false if the
kono
parents:
diff changeset
414 -- type is normally passed by copy in calls. For scalar types, the
kono
parents:
diff changeset
415 -- result is always False and is static. For non-scalar types, the
kono
parents:
diff changeset
416 -- result is non-static (since it is computed by Gigi).
kono
parents:
diff changeset
417
kono
parents:
diff changeset
418 ------------------
kono
parents:
diff changeset
419 -- Range_Length --
kono
parents:
diff changeset
420 ------------------
kono
parents:
diff changeset
421
kono
parents:
diff changeset
422 Attribute_Range_Length => True,
kono
parents:
diff changeset
423 -- T'Range_Length for any discrete type T yields the number of values
kono
parents:
diff changeset
424 -- represented by the subtype (zero for a null range). The result is
kono
parents:
diff changeset
425 -- static for static subtypes. Note that Range_Length applied to the
kono
parents:
diff changeset
426 -- index subtype of a one dimensional array always gives the same result
kono
parents:
diff changeset
427 -- as Range applied to the array itself. The result is of type universal
kono
parents:
diff changeset
428 -- integer.
kono
parents:
diff changeset
429
kono
parents:
diff changeset
430 ---------
kono
parents:
diff changeset
431 -- Ref --
kono
parents:
diff changeset
432 ---------
kono
parents:
diff changeset
433
kono
parents:
diff changeset
434 Attribute_Ref => True,
kono
parents:
diff changeset
435 -- System.Address'Ref (Address is the only permissible prefix) is
kono
parents:
diff changeset
436 -- equivalent to System'To_Address, provided for compatibility with
kono
parents:
diff changeset
437 -- other compilers.
kono
parents:
diff changeset
438
kono
parents:
diff changeset
439 ------------------
kono
parents:
diff changeset
440 -- Storage_Unit --
kono
parents:
diff changeset
441 ------------------
kono
parents:
diff changeset
442
kono
parents:
diff changeset
443 Attribute_Storage_Unit => True,
kono
parents:
diff changeset
444 -- Standard'Storage_Unit (Standard is the only permissible prefix)
kono
parents:
diff changeset
445 -- provides the value System.Storage_Unit, and is intended primarily
kono
parents:
diff changeset
446 -- for constructing this definition in package System (see note above
kono
parents:
diff changeset
447 -- in Default_Bit_Order description). The is a static attribute.
kono
parents:
diff changeset
448
kono
parents:
diff changeset
449 ---------------
kono
parents:
diff changeset
450 -- Stub_Type --
kono
parents:
diff changeset
451 ---------------
kono
parents:
diff changeset
452
kono
parents:
diff changeset
453 Attribute_Stub_Type => True,
kono
parents:
diff changeset
454 -- The GNAT implementation of remote access-to-classwide types is
kono
parents:
diff changeset
455 -- organised as described in AARM E.4(20.t): a value of an RACW type
kono
parents:
diff changeset
456 -- (designating a remote object) is represented as a normal access
kono
parents:
diff changeset
457 -- value, pointing to a "stub" object which in turn contains the
kono
parents:
diff changeset
458 -- necessary information to contact the designated remote object. A
kono
parents:
diff changeset
459 -- call on any dispatching operation of such a stub object does the
kono
parents:
diff changeset
460 -- remote call, if necessary, using the information in the stub object
kono
parents:
diff changeset
461 -- to locate the target partition, etc.
kono
parents:
diff changeset
462 --
kono
parents:
diff changeset
463 -- For a prefix T that denotes a remote access-to-classwide type,
kono
parents:
diff changeset
464 -- T'Stub_Type denotes the type of the corresponding stub objects.
kono
parents:
diff changeset
465 --
kono
parents:
diff changeset
466 -- By construction, the layout of T'Stub_Type is identical to that of
kono
parents:
diff changeset
467 -- System.Partition_Interface.RACW_Stub_Type (see implementation notes
kono
parents:
diff changeset
468 -- in body of Exp_Dist).
kono
parents:
diff changeset
469
kono
parents:
diff changeset
470 -----------------
kono
parents:
diff changeset
471 -- Target_Name --
kono
parents:
diff changeset
472 -----------------
kono
parents:
diff changeset
473
kono
parents:
diff changeset
474 Attribute_Target_Name => True,
kono
parents:
diff changeset
475 -- Standard'Target_Name yields the string identifying the target for the
kono
parents:
diff changeset
476 -- compilation, taken from Sdefault.Target_Name.
kono
parents:
diff changeset
477
kono
parents:
diff changeset
478 ----------------
kono
parents:
diff changeset
479 -- To_Address --
kono
parents:
diff changeset
480 ----------------
kono
parents:
diff changeset
481
kono
parents:
diff changeset
482 Attribute_To_Address => True,
kono
parents:
diff changeset
483 -- System'To_Address (System is the only permissible prefix) is a
kono
parents:
diff changeset
484 -- function that takes any integer value, and converts it into an
kono
parents:
diff changeset
485 -- address value. The semantics is to first convert the integer value to
kono
parents:
diff changeset
486 -- type Integer_Address according to normal conversion rules, and then
kono
parents:
diff changeset
487 -- to convert this to an address using the same semantics as the
kono
parents:
diff changeset
488 -- System.Storage_Elements.To_Address function. The important difference
kono
parents:
diff changeset
489 -- is that this is a static attribute so it can be used in
kono
parents:
diff changeset
490 -- initializations in preelaborate packages.
kono
parents:
diff changeset
491
kono
parents:
diff changeset
492 ----------------
kono
parents:
diff changeset
493 -- Type_Class --
kono
parents:
diff changeset
494 ----------------
kono
parents:
diff changeset
495
kono
parents:
diff changeset
496 Attribute_Type_Class => True,
kono
parents:
diff changeset
497 -- T'Type_Class for any type or subtype T yields the value of the type
kono
parents:
diff changeset
498 -- class for the full type of T. If T is a generic formal type, then the
kono
parents:
diff changeset
499 -- value is the value for the corresponding actual subtype. The value of
kono
parents:
diff changeset
500 -- this attribute is of type System.Aux_DEC.Type_Class, which has the
kono
parents:
diff changeset
501 -- following definition:
kono
parents:
diff changeset
502 --
kono
parents:
diff changeset
503 -- type Type_Class is
kono
parents:
diff changeset
504 -- (Type_Class_Enumeration,
kono
parents:
diff changeset
505 -- Type_Class_Integer,
kono
parents:
diff changeset
506 -- Type_Class_Fixed_Point,
kono
parents:
diff changeset
507 -- Type_Class_Floating_Point,
kono
parents:
diff changeset
508 -- Type_Class_Array,
kono
parents:
diff changeset
509 -- Type_Class_Record,
kono
parents:
diff changeset
510 -- Type_Class_Access,
kono
parents:
diff changeset
511 -- Type_Class_Task,
kono
parents:
diff changeset
512 -- Type_Class_Address);
kono
parents:
diff changeset
513 --
kono
parents:
diff changeset
514 -- Protected types yield the value Type_Class_Task, which thus applies
kono
parents:
diff changeset
515 -- to all concurrent types. This attribute is designed to be compatible
kono
parents:
diff changeset
516 -- with the DEC Ada attribute of the same name.
kono
parents:
diff changeset
517 --
kono
parents:
diff changeset
518 -- Note: if pragma Extend_System is used to merge the definitions of
kono
parents:
diff changeset
519 -- Aux_DEC into System, then the type Type_Class can be referenced
kono
parents:
diff changeset
520 -- as an entity within System, as can its enumeration literals.
kono
parents:
diff changeset
521
kono
parents:
diff changeset
522 ------------------------------
kono
parents:
diff changeset
523 -- Universal_Literal_String --
kono
parents:
diff changeset
524 ------------------------------
kono
parents:
diff changeset
525
kono
parents:
diff changeset
526 Attribute_Universal_Literal_String => True,
kono
parents:
diff changeset
527 -- The prefix of 'Universal_Literal_String must be a named number.
kono
parents:
diff changeset
528 -- The static result is the string consisting of the characters of
kono
parents:
diff changeset
529 -- the number as defined in the original source. This allows the
kono
parents:
diff changeset
530 -- user program to access the actual text of named numbers without
kono
parents:
diff changeset
531 -- intermediate conversions and without the need to enclose the
kono
parents:
diff changeset
532 -- strings in quotes (which would preclude their use as numbers).
kono
parents:
diff changeset
533
kono
parents:
diff changeset
534 -------------------------
kono
parents:
diff changeset
535 -- Unrestricted_Access --
kono
parents:
diff changeset
536 -------------------------
kono
parents:
diff changeset
537
kono
parents:
diff changeset
538 Attribute_Unrestricted_Access => True,
kono
parents:
diff changeset
539 -- The Unrestricted_Access attribute is similar to Access except that
kono
parents:
diff changeset
540 -- all accessibility and aliased view checks are omitted. This is very
kono
parents:
diff changeset
541 -- much a user-beware attribute. Basically its status is very similar
kono
parents:
diff changeset
542 -- to Address, for which it is a desirable replacement where the value
kono
parents:
diff changeset
543 -- desired is an access type. In other words, its effect is identical
kono
parents:
diff changeset
544 -- to first taking 'Address and then doing an unchecked conversion to
kono
parents:
diff changeset
545 -- a desired access type. Note that in GNAT, but not necessarily in
kono
parents:
diff changeset
546 -- other implementations, the use of static chains for inner level
kono
parents:
diff changeset
547 -- subprograms means that Unrestricted_Access applied to a subprogram
kono
parents:
diff changeset
548 -- yields a value that can be called as long as the subprogram is in
kono
parents:
diff changeset
549 -- scope (normal Ada 95 accessibility rules restrict this usage).
kono
parents:
diff changeset
550
kono
parents:
diff changeset
551 ---------------
kono
parents:
diff changeset
552 -- VADS_Size --
kono
parents:
diff changeset
553 ---------------
kono
parents:
diff changeset
554
kono
parents:
diff changeset
555 Attribute_VADS_Size => True,
kono
parents:
diff changeset
556 -- Typ'VADS_Size yields the Size value typically yielded by some Ada 83
kono
parents:
diff changeset
557 -- compilers. The differences between VADS_Size and Size is that for
kono
parents:
diff changeset
558 -- scalar types for which no Size has been specified, VADS_Size yields
kono
parents:
diff changeset
559 -- the Object_Size rather than the Value_Size. For example, while
kono
parents:
diff changeset
560 -- Natural'Size is typically 31, the value of Natural'VADS_Size is 32.
kono
parents:
diff changeset
561 -- For all other types, Size and VADS_Size yield the same value.
kono
parents:
diff changeset
562
kono
parents:
diff changeset
563 -------------------
kono
parents:
diff changeset
564 -- Valid_Scalars --
kono
parents:
diff changeset
565 -------------------
kono
parents:
diff changeset
566
kono
parents:
diff changeset
567 Attribute_Valid_Scalars => True,
kono
parents:
diff changeset
568 -- Obj'Valid_Scalars can be applied to any object. The result depends
kono
parents:
diff changeset
569 -- on the type of the object:
kono
parents:
diff changeset
570 --
kono
parents:
diff changeset
571 -- For a scalar type, the result is the same as obj'Valid
kono
parents:
diff changeset
572 --
kono
parents:
diff changeset
573 -- For an array object, the result is True if the result of applying
kono
parents:
diff changeset
574 -- Valid_Scalars to every component is True. For an empty array the
kono
parents:
diff changeset
575 -- result is True.
kono
parents:
diff changeset
576 --
kono
parents:
diff changeset
577 -- For a record object, the result is True if the result of applying
kono
parents:
diff changeset
578 -- Valid_Scalars to every component is True. For class-wide types,
kono
parents:
diff changeset
579 -- only the components of the base type are checked. For variant
kono
parents:
diff changeset
580 -- records, only the components actually present are checked. The
kono
parents:
diff changeset
581 -- discriminants, if any, are also checked. If there are no components
kono
parents:
diff changeset
582 -- or discriminants, the result is True.
kono
parents:
diff changeset
583 --
kono
parents:
diff changeset
584 -- For any other type that has discriminants, the result is True if
kono
parents:
diff changeset
585 -- the result of applying Valid_Scalars to each discriminant is True.
kono
parents:
diff changeset
586 --
kono
parents:
diff changeset
587 -- For all other types, the result is always True
kono
parents:
diff changeset
588 --
kono
parents:
diff changeset
589 -- A warning is given for a trivially True result, when the attribute
kono
parents:
diff changeset
590 -- is applied to an object that is not of scalar, array, or record
kono
parents:
diff changeset
591 -- type, or in the composite case if no scalar subcomponents exist. For
kono
parents:
diff changeset
592 -- a variant record, the warning is given only if none of the variants
kono
parents:
diff changeset
593 -- have scalar subcomponents. In addition, the warning is suppressed
kono
parents:
diff changeset
594 -- for private types, or generic formal types in an instance.
kono
parents:
diff changeset
595
kono
parents:
diff changeset
596 ----------------
kono
parents:
diff changeset
597 -- Value_Size --
kono
parents:
diff changeset
598 ----------------
kono
parents:
diff changeset
599
kono
parents:
diff changeset
600 Attribute_Value_Size => True,
kono
parents:
diff changeset
601 -- Type'Value_Size is the number of bits required to represent value of
kono
parents:
diff changeset
602 -- the given subtype. It is the same as Type'Size, but, unlike Size, may
kono
parents:
diff changeset
603 -- be set for non-first subtypes. See section in Einfo ("Handling of
kono
parents:
diff changeset
604 -- type'Size values") for further details.
kono
parents:
diff changeset
605
kono
parents:
diff changeset
606 ---------------
kono
parents:
diff changeset
607 -- Word_Size --
kono
parents:
diff changeset
608 ---------------
kono
parents:
diff changeset
609
kono
parents:
diff changeset
610 Attribute_Word_Size => True,
kono
parents:
diff changeset
611 -- Standard'Word_Size (Standard is the only permissible prefix)
kono
parents:
diff changeset
612 -- provides the value System.Word_Size, and is intended primarily
kono
parents:
diff changeset
613 -- for constructing this definition in package System (see note above
kono
parents:
diff changeset
614 -- in Default_Bit_Order description). This is a static attribute.
kono
parents:
diff changeset
615
kono
parents:
diff changeset
616 others => False);
kono
parents:
diff changeset
617
kono
parents:
diff changeset
618 -- The following table lists all attributes that yield a result of a
kono
parents:
diff changeset
619 -- universal type.
kono
parents:
diff changeset
620
kono
parents:
diff changeset
621 Universal_Type_Attribute : constant array (Attribute_Id) of Boolean :=
kono
parents:
diff changeset
622 (Attribute_Aft => True,
kono
parents:
diff changeset
623 Attribute_Alignment => True,
kono
parents:
diff changeset
624 Attribute_Component_Size => True,
kono
parents:
diff changeset
625 Attribute_Count => True,
kono
parents:
diff changeset
626 Attribute_Delta => True,
kono
parents:
diff changeset
627 Attribute_Digits => True,
kono
parents:
diff changeset
628 Attribute_Exponent => True,
kono
parents:
diff changeset
629 Attribute_First_Bit => True,
kono
parents:
diff changeset
630 Attribute_Fore => True,
kono
parents:
diff changeset
631 Attribute_Last_Bit => True,
kono
parents:
diff changeset
632 Attribute_Length => True,
kono
parents:
diff changeset
633 Attribute_Machine_Emax => True,
kono
parents:
diff changeset
634 Attribute_Machine_Emin => True,
kono
parents:
diff changeset
635 Attribute_Machine_Mantissa => True,
kono
parents:
diff changeset
636 Attribute_Machine_Radix => True,
kono
parents:
diff changeset
637 Attribute_Max_Alignment_For_Allocation => True,
kono
parents:
diff changeset
638 Attribute_Max_Size_In_Storage_Elements => True,
kono
parents:
diff changeset
639 Attribute_Model_Emin => True,
kono
parents:
diff changeset
640 Attribute_Model_Epsilon => True,
kono
parents:
diff changeset
641 Attribute_Model_Mantissa => True,
kono
parents:
diff changeset
642 Attribute_Model_Small => True,
kono
parents:
diff changeset
643 Attribute_Modulus => True,
kono
parents:
diff changeset
644 Attribute_Pos => True,
kono
parents:
diff changeset
645 Attribute_Position => True,
kono
parents:
diff changeset
646 Attribute_Safe_First => True,
kono
parents:
diff changeset
647 Attribute_Safe_Last => True,
kono
parents:
diff changeset
648 Attribute_Scale => True,
kono
parents:
diff changeset
649 Attribute_Size => True,
kono
parents:
diff changeset
650 Attribute_Small => True,
kono
parents:
diff changeset
651 Attribute_Wide_Wide_Width => True,
kono
parents:
diff changeset
652 Attribute_Wide_Width => True,
kono
parents:
diff changeset
653 Attribute_Width => True,
kono
parents:
diff changeset
654 others => False);
kono
parents:
diff changeset
655
kono
parents:
diff changeset
656 -----------------
kono
parents:
diff changeset
657 -- Subprograms --
kono
parents:
diff changeset
658 -----------------
kono
parents:
diff changeset
659
kono
parents:
diff changeset
660 procedure Analyze_Attribute (N : Node_Id);
kono
parents:
diff changeset
661 -- Performs bottom up semantic analysis of an attribute. Note that the
kono
parents:
diff changeset
662 -- parser has already checked that type returning attributes appear only
kono
parents:
diff changeset
663 -- in appropriate contexts (i.e. in subtype marks, or as prefixes for
kono
parents:
diff changeset
664 -- other attributes).
kono
parents:
diff changeset
665
kono
parents:
diff changeset
666 function Name_Implies_Lvalue_Prefix (Nam : Name_Id) return Boolean;
kono
parents:
diff changeset
667 -- Determine whether the name of an attribute reference categorizes its
kono
parents:
diff changeset
668 -- prefix as an lvalue. The following attributes fall under this bracket
kono
parents:
diff changeset
669 -- by directly or indirectly modifying their prefixes.
kono
parents:
diff changeset
670 -- Access
kono
parents:
diff changeset
671 -- Address
kono
parents:
diff changeset
672 -- Input
kono
parents:
diff changeset
673 -- Read
kono
parents:
diff changeset
674 -- Unchecked_Access
kono
parents:
diff changeset
675 -- Unrestricted_Access
kono
parents:
diff changeset
676
kono
parents:
diff changeset
677 procedure Resolve_Attribute (N : Node_Id; Typ : Entity_Id);
kono
parents:
diff changeset
678 -- Performs type resolution of attribute. If the attribute yields a
kono
parents:
diff changeset
679 -- universal value, mark its type as that of the context. On the other
kono
parents:
diff changeset
680 -- hand, if the context itself is universal (as in T'Val (T'Pos (X)), mark
kono
parents:
diff changeset
681 -- the type as being the largest type of that class that can be used at
kono
parents:
diff changeset
682 -- run-time. This is correct since either the value gets folded (in which
kono
parents:
diff changeset
683 -- case it doesn't matter what type of the class we give if, since the
kono
parents:
diff changeset
684 -- folding uses universal arithmetic anyway) or it doesn't get folded (in
kono
parents:
diff changeset
685 -- which case it is going to be dealt with at runtime, and the largest type
kono
parents:
diff changeset
686 -- is right).
kono
parents:
diff changeset
687
kono
parents:
diff changeset
688 function Stream_Attribute_Available
kono
parents:
diff changeset
689 (Typ : Entity_Id;
kono
parents:
diff changeset
690 Nam : TSS_Name_Type;
kono
parents:
diff changeset
691 Partial_View : Entity_Id := Empty) return Boolean;
kono
parents:
diff changeset
692 -- For a limited type Typ, return True if and only if the given attribute
kono
parents:
diff changeset
693 -- is available. For Ada 2005, availability is defined by 13.13.2(36/1).
kono
parents:
diff changeset
694 -- For Ada 95, an attribute is considered to be available if it has been
kono
parents:
diff changeset
695 -- specified using an attribute definition clause for the type, or for its
kono
parents:
diff changeset
696 -- full view, or for an ancestor of either. Parameter Partial_View is used
kono
parents:
diff changeset
697 -- only internally, when checking for an attribute definition clause that
kono
parents:
diff changeset
698 -- is not visible (Ada 95 only).
kono
parents:
diff changeset
699
kono
parents:
diff changeset
700 end Sem_Attr;