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