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