1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2023, Free Software Foundation, Inc. --
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. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
26 -- This package contains the declarations of entities in package Standard,
27 -- These values are initialized either by calling CStand.Create_Standard,
28 -- or by calling Stand.Tree_Read.
30 with Types
; use Types
;
34 -- Warning: the entities defined in this package are written out by the
35 -- Tree_Write routine, and read back in by the Tree_Read routine, so be
36 -- sure to modify these two routines if you add entities that are not
37 -- part of Standard_Entity.
39 type Standard_Entity_Type
is (
40 -- This enumeration type contains an entry for each name in Standard
47 -- Types and subtypes defined in package Standard (in the order in which
48 -- they appear in the RM, so that the declarations are in the right
49 -- order for the purposes of e.g. ASIS traversals
53 S_Short_Short_Integer
,
58 S_Long_Long_Long_Integer
,
70 S_Wide_Wide_Character
,
78 -- Enumeration literals for type Boolean
83 -- Exceptions declared in package Standard
91 -- Binary Operators declared in package Standard
113 -- Unary operators declared in package Standard
120 -- Constants defined in package ASCII (with value in hex).
121 -- First the thirty-two C0 control characters)
156 -- Here are the ones for Colonel Whitaker's O26 keypunch
159 S_Quotation
, -- 16#22#
163 S_Ampersand
, -- 16#26#
166 S_Semicolon
, -- 16#3B#
171 S_L_Bracket
, -- 16#5B#
172 S_Back_Slash
, -- 16#5C#
173 S_R_Bracket
, -- 16#5D#
174 S_Circumflex
, -- 16#5E#
175 S_Underline
, -- 16#5F#
210 -- And one more control character, all on its own
215 Standard_Entity_Type
range S_Boolean
.. S_Duration
;
217 subtype S_Exceptions
is
218 Standard_Entity_Type
range S_Constraint_Error
.. S_Tasking_Error
;
220 subtype S_ASCII_Names
is
221 Standard_Entity_Type
range S_NUL
.. S_DEL
;
223 subtype S_Binary_Ops
is
224 Standard_Entity_Type
range S_Op_Add
.. S_Op_Xor
;
226 subtype S_Unary_Ops
is
227 Standard_Entity_Type
range S_Op_Abs
.. S_Op_Plus
;
229 type Standard_Entity_Array_Type
is array (Standard_Entity_Type
) of Node_Id
;
231 Standard_Entity
: Standard_Entity_Array_Type
;
232 -- This array contains pointers to the Defining Identifier nodes for each
233 -- of the visible entities defined in Standard_Entities_Type. The array is
234 -- initialized by the Create_Standard procedure.
236 Standard_Package_Node
: Node_Id
;
237 -- Points to the N_Package_Declaration node for standard. Also
238 -- initialized by the Create_Standard procedure.
240 -- The following Entities are the pointers to the Defining Identifier
241 -- nodes for some visible entities defined in Standard_Entities_Type.
243 SE
: Standard_Entity_Array_Type
renames Standard_Entity
;
245 Standard_Standard
: Entity_Id
renames SE
(S_Standard
);
247 Standard_ASCII
: Entity_Id
renames SE
(S_ASCII
);
248 Standard_Character
: Entity_Id
renames SE
(S_Character
);
249 Standard_Wide_Character
: Entity_Id
renames SE
(S_Wide_Character
);
250 Standard_Wide_Wide_Character
: Entity_Id
renames SE
(S_Wide_Wide_Character
);
251 Standard_String
: Entity_Id
renames SE
(S_String
);
252 Standard_Wide_String
: Entity_Id
renames SE
(S_Wide_String
);
253 Standard_Wide_Wide_String
: Entity_Id
renames SE
(S_Wide_Wide_String
);
255 Standard_Boolean
: Entity_Id
renames SE
(S_Boolean
);
256 Standard_False
: Entity_Id
renames SE
(S_False
);
257 Standard_True
: Entity_Id
renames SE
(S_True
);
259 Standard_Duration
: Entity_Id
renames SE
(S_Duration
);
261 Standard_Natural
: Entity_Id
renames SE
(S_Natural
);
262 Standard_Positive
: Entity_Id
renames SE
(S_Positive
);
264 Standard_Constraint_Error
: Entity_Id
renames SE
(S_Constraint_Error
);
265 Standard_Numeric_Error
: Entity_Id
renames SE
(S_Numeric_Error
);
266 Standard_Program_Error
: Entity_Id
renames SE
(S_Program_Error
);
267 Standard_Storage_Error
: Entity_Id
renames SE
(S_Storage_Error
);
268 Standard_Tasking_Error
: Entity_Id
renames SE
(S_Tasking_Error
);
270 Standard_Short_Float
: Entity_Id
renames SE
(S_Short_Float
);
271 Standard_Float
: Entity_Id
renames SE
(S_Float
);
272 Standard_Long_Float
: Entity_Id
renames SE
(S_Long_Float
);
273 Standard_Long_Long_Float
: Entity_Id
renames SE
(S_Long_Long_Float
);
275 Standard_Short_Short_Integer
: Entity_Id
renames SE
(S_Short_Short_Integer
);
276 Standard_Short_Integer
: Entity_Id
renames SE
(S_Short_Integer
);
277 Standard_Integer
: Entity_Id
renames SE
(S_Integer
);
278 Standard_Long_Integer
: Entity_Id
renames SE
(S_Long_Integer
);
279 Standard_Long_Long_Integer
: Entity_Id
renames SE
(S_Long_Long_Integer
);
281 Standard_Long_Long_Long_Integer
: Entity_Id
renames
282 SE
(S_Long_Long_Long_Integer
);
284 Standard_Op_Add
: Entity_Id
renames SE
(S_Op_Add
);
285 Standard_Op_And
: Entity_Id
renames SE
(S_Op_And
);
286 Standard_Op_Concat
: Entity_Id
renames SE
(S_Op_Concat
);
287 Standard_Op_Concatw
: Entity_Id
renames SE
(S_Op_Concatw
);
288 Standard_Op_Concatww
: Entity_Id
renames SE
(S_Op_Concatww
);
289 Standard_Op_Divide
: Entity_Id
renames SE
(S_Op_Divide
);
290 Standard_Op_Eq
: Entity_Id
renames SE
(S_Op_Eq
);
291 Standard_Op_Expon
: Entity_Id
renames SE
(S_Op_Expon
);
292 Standard_Op_Ge
: Entity_Id
renames SE
(S_Op_Ge
);
293 Standard_Op_Gt
: Entity_Id
renames SE
(S_Op_Gt
);
294 Standard_Op_Le
: Entity_Id
renames SE
(S_Op_Le
);
295 Standard_Op_Lt
: Entity_Id
renames SE
(S_Op_Lt
);
296 Standard_Op_Mod
: Entity_Id
renames SE
(S_Op_Mod
);
297 Standard_Op_Multiply
: Entity_Id
renames SE
(S_Op_Multiply
);
298 Standard_Op_Ne
: Entity_Id
renames SE
(S_Op_Ne
);
299 Standard_Op_Or
: Entity_Id
renames SE
(S_Op_Or
);
300 Standard_Op_Rem
: Entity_Id
renames SE
(S_Op_Rem
);
301 Standard_Op_Subtract
: Entity_Id
renames SE
(S_Op_Subtract
);
302 Standard_Op_Xor
: Entity_Id
renames SE
(S_Op_Xor
);
304 Standard_Op_Abs
: Entity_Id
renames SE
(S_Op_Abs
);
305 Standard_Op_Minus
: Entity_Id
renames SE
(S_Op_Minus
);
306 Standard_Op_Not
: Entity_Id
renames SE
(S_Op_Not
);
307 Standard_Op_Plus
: Entity_Id
renames SE
(S_Op_Plus
);
309 Last_Standard_Node_Id
: Node_Id
;
310 -- Highest Node_Id value used by Standard
312 Last_Standard_List_Id
: List_Id
;
313 -- Highest List_Id value used by Standard (including those used by
314 -- normal list headers, element list headers, and list elements)
316 Boolean_Literals
: array (Boolean) of Entity_Id
;
317 -- Entities for the two boolean literals, used by the expander
319 -------------------------------------
320 -- Semantic Phase Special Entities --
321 -------------------------------------
323 -- The semantic phase needs a number of entities for internal processing
324 -- that are logically at the level of Standard, and hence defined in this
325 -- package. However, they are never visible to a program, and are not
326 -- chained on to the Decls list of Standard. The names of all these
327 -- types are relevant only in certain debugging and error message
328 -- situations. They have names that are suitable for use in such
329 -- error messages (see body for actual names used).
331 Standard_Void_Type
: Entity_Id
;
332 -- This is a type used to represent the return type of procedures
334 Standard_Exception_Type
: Entity_Id
;
335 -- This is a type used to represent the Etype of exceptions
337 Standard_A_String
: Entity_Id
;
338 -- An access to String type used for building elements of tables carrying
339 -- the enumeration literal names.
341 Standard_A_Char
: Entity_Id
;
342 -- An access to character type, used as a component of the exception type
343 -- to denote a thin pointer component. Needed for non-GCC back-ends.
345 Standard_Debug_Renaming_Type
: Entity_Id
;
346 -- A zero-size subtype of Integer, used as the type of variables used to
347 -- provide the debugger with name encodings for renaming declarations.
349 Predefined_Float_Types
: Elist_Id
;
350 -- Entities for predefined floating point types. These are used by
351 -- the semantic phase to select appropriate types for floating point
352 -- declarations. This list is ordered by preference. All types up to
353 -- Long_Long_Float_Type are considered for plain "digits N" declarations,
354 -- while selection of later types requires a range specification and
355 -- possibly other attributes or pragmas.
357 -- The entities labeled Any_xxx are used in situations where the full
358 -- characteristics of an entity are not yet known, e.g. Any_Character
359 -- is used to label a character literal before resolution is complete.
360 -- These entities are also used to construct appropriate references in
361 -- error messages ("expecting an integer type").
364 -- Used to represent some unknown identifier. Used to label undefined
365 -- identifier references to prevent cascaded errors.
367 Any_Type
: Entity_Id
;
368 -- Used to represent some unknown type. Any_Type is the type of an
369 -- unresolved operator, and it is the type of a node where a type error
370 -- has been detected. Any_Type plays an important role in avoiding cascaded
371 -- errors, because it is compatible with all other types, and is propagated
372 -- to any expression that has a subexpression of Any_Type. When resolving
373 -- operators, Any_Type is the initial type of the node before any of its
374 -- candidate interpretations has been examined. If after examining all of
375 -- them the type is still Any_Type, the node has no possible interpretation
376 -- and an error can be emitted (and Any_Type will be propagated upwards).
378 Any_Array
: Entity_Id
;
379 -- Used to represent some unknown array type
381 Any_Boolean
: Entity_Id
;
382 -- The context type of conditions in IF and WHILE statements
384 Any_Character
: Entity_Id
;
385 -- Any_Character is used to label character literals, which in general
386 -- will not have an explicit declaration (this is true of the predefined
389 Any_Composite
: Entity_Id
;
390 -- The type Any_Composite is used for aggregates before type resolution.
391 -- It is compatible with any array or non-limited record type.
393 Any_Discrete
: Entity_Id
;
394 -- Used to represent some unknown discrete type
396 Any_Fixed
: Entity_Id
;
397 -- Used to represent some unknown fixed-point type
399 Any_Integer
: Entity_Id
;
400 -- Used to represent some unknown integer type
402 Any_Modular
: Entity_Id
;
403 -- Used to represent the result type of a boolean operation on an integer
404 -- literal. The result is not Universal_Integer, because it is only legal
405 -- in a modular context.
407 Any_Numeric
: Entity_Id
;
408 -- Used to represent some unknown numeric type
410 Any_Real
: Entity_Id
;
411 -- Used to represent some unknown real type
413 Any_Scalar
: Entity_Id
;
414 -- Used to represent some unknown scalar type
416 Any_String
: Entity_Id
;
417 -- The type Any_String is used for string literals before type resolution.
418 -- It corresponds to array (Positive range <>) of character where the
419 -- component type is compatible with any character type, not just
420 -- Standard_Character.
422 Raise_Type
: Entity_Id
;
423 -- The type Raise_Type denotes the type of a Raise_Expression. It is
424 -- compatible with all other types, and must eventually resolve to a
425 -- concrete type that is imposed by the context.
427 -- Historical note: we used to use Any_Type for this purpose, but the
428 -- confusion of meanings (Any_Type normally indicates an error) caused
429 -- difficulties. In particular some needed expansions were skipped since
430 -- the nodes in question looked like they had an error.
432 Universal_Integer
: Entity_Id
;
433 -- Entity for universal integer type. The bounds of this type correspond
434 -- to the largest supported integer type (i.e. Long_Long_Long_Integer).
435 -- It is the type used for runtime calculations in type universal integer.
437 Universal_Real
: Entity_Id
;
438 -- Entity for universal real type. The bounds of this type correspond to
439 -- to the largest supported real type (i.e. Long_Long_Float). It is the
440 -- type used for runtime calculations in type universal real. Note that
441 -- this type is always IEEE format.
443 Universal_Fixed
: Entity_Id
;
444 -- Entity for universal fixed type. This is a type with arbitrary
445 -- precision that can only appear in a context with a specific type.
446 -- Universal_Fixed labels the result of multiplication or division of
447 -- two fixed point numbers, and has no specified bounds (since, unlike
448 -- universal integer and universal real, it is never used for runtime
451 Universal_Access
: Entity_Id
;
452 -- Entity for universal access type. It is only used for the literal null
454 Standard_Integer_8
: Entity_Id
;
455 Standard_Integer_16
: Entity_Id
;
456 Standard_Integer_32
: Entity_Id
;
457 Standard_Integer_64
: Entity_Id
;
458 Standard_Integer_128
: Entity_Id
;
459 -- These are signed integer types with the indicated sizes. Used for the
460 -- underlying implementation types for fixed-point and enumeration types.
462 Standard_Short_Short_Unsigned
: Entity_Id
;
463 Standard_Short_Unsigned
: Entity_Id
;
464 Standard_Unsigned
: Entity_Id
;
465 Standard_Long_Unsigned
: Entity_Id
;
466 Standard_Long_Long_Unsigned
: Entity_Id
;
467 Standard_Long_Long_Long_Unsigned
: Entity_Id
;
468 -- Unsigned types with same Esize as corresponding signed integer types
470 Standard_Unsigned_64
: Entity_Id
;
471 -- Entity for an unsigned type mod 2 ** 64, size of 64 bits.
473 Standard_Address
: Entity_Id
;
474 -- Entity for an unsigned type mod 2 ** System_Address_Size, size of
475 -- System_Address_Size bits. Used for implementing Allow_Integer_Address.
477 Abort_Signal
: Entity_Id
;
478 -- Entity for abort signal exception
480 Standard_Op_Rotate_Left
: Entity_Id
;
481 Standard_Op_Rotate_Right
: Entity_Id
;
482 Standard_Op_Shift_Left
: Entity_Id
;
483 Standard_Op_Shift_Right
: Entity_Id
;
484 Standard_Op_Shift_Right_Arithmetic
: Entity_Id
;
485 -- These entities are used for shift operators generated by the expander