| 1 |
/**************************************************************************** |
| 2 |
* * |
| 3 |
* GNAT COMPILER COMPONENTS * |
| 4 |
* * |
| 5 |
* T Y P E S * |
| 6 |
* * |
| 7 |
* C Header File * |
| 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. 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. * |
| 20 |
* * |
| 21 |
* GNAT was originally developed by the GNAT team at New York University. * |
| 22 |
* Extensive contributions were provided by Ada Core Technologies Inc. * |
| 23 |
* * |
| 24 |
****************************************************************************/ |
| 25 |
|
| 26 |
/* This is the C header that corresponds to the Ada package specification for |
| 27 |
Types. It was created manually from types.ads and must be kept synchronized |
| 28 |
with changes in this file. |
| 29 |
|
| 30 |
This package contains host independent type definitions which are used |
| 31 |
throughout the compiler modules. The comments in the C version are brief |
| 32 |
reminders of the purpose of each declaration. For complete documentation, |
| 33 |
see the Ada version of these definitions. */ |
| 34 |
|
| 35 |
/* Boolean Types: */ |
| 36 |
|
| 37 |
/* Boolean type (cannot use enum, because of bit field restriction on some |
| 38 |
compilers). */ |
| 39 |
typedef unsigned char Boolean; |
| 40 |
#define False 0 |
| 41 |
#define True 1 |
| 42 |
|
| 43 |
/* General Use Integer Types */ |
| 44 |
|
| 45 |
/* Signed 32-bit integer */ |
| 46 |
typedef int Int; |
| 47 |
|
| 48 |
/* Signed 16-bit integer */ |
| 49 |
typedef short Short; |
| 50 |
|
| 51 |
/* Non-negative Int values */ |
| 52 |
typedef Int Nat; |
| 53 |
|
| 54 |
/* Positive Int values */ |
| 55 |
typedef Int Pos; |
| 56 |
|
| 57 |
/* 8-bit unsigned integer */ |
| 58 |
typedef unsigned char Byte; |
| 59 |
|
| 60 |
/* 8-Bit Character and String Types: */ |
| 61 |
|
| 62 |
/* 8-bit character type */ |
| 63 |
typedef char Char; |
| 64 |
|
| 65 |
/* Graphic characters, as defined in ARM */ |
| 66 |
typedef Char Graphic_Character; |
| 67 |
|
| 68 |
/* Line terminator characters (LF, VT, FF, CR) */ |
| 69 |
typedef Char Line_Terminator; |
| 70 |
|
| 71 |
/* Characters with the upper bit set */ |
| 72 |
typedef Char Upper_Half_Character; |
| 73 |
|
| 74 |
/* String type built on Char (note that zero is an OK index) */ |
| 75 |
typedef Char *Str; |
| 76 |
|
| 77 |
/* Pointer to string of Chars */ |
| 78 |
typedef Char *Str_Ptr; |
| 79 |
|
| 80 |
/* Types for the fat pointer used for strings and the template it points to. |
| 81 |
The fat pointer is conceptually a couple of pointers, but it is wrapped |
| 82 |
up in a special record type. On the Ada side, the record is naturally |
| 83 |
aligned (i.e. given pointer alignment) on regular platforms, but it is |
| 84 |
given twice this alignment on strict-alignment platforms for performance |
| 85 |
reasons. On the C side, for the sake of portability and simplicity, we |
| 86 |
overalign it on all platforms (so the machine mode is always the same as |
| 87 |
on the Ada side) but arrange to pass it in an even scalar position as a |
| 88 |
parameter to functions (so the scalar parameter alignment is always the |
| 89 |
same as on the Ada side). */ |
| 90 |
typedef struct { int Low_Bound, High_Bound; } String_Template; |
| 91 |
typedef struct { const char *Array; String_Template *Bounds; } |
| 92 |
__attribute ((aligned (sizeof (char *) * 2))) String_Pointer; |
| 93 |
|
| 94 |
/* Types for Node/Entity Kinds: */ |
| 95 |
|
| 96 |
/* The reason that these are defined here in the C version, rather than in the |
| 97 |
corresponding packages is that the requirement for putting bodies of |
| 98 |
inlined stuff IN the C header changes the dependencies. Both sinfo.h |
| 99 |
and einfo.h now reference routines defined in tree.h. |
| 100 |
|
| 101 |
Note: these types would more naturally be defined as unsigned char, but |
| 102 |
once again, the annoying restriction on bit fields for some compilers |
| 103 |
bites us! */ |
| 104 |
|
| 105 |
enum Node_Kind : unsigned int; |
| 106 |
enum Entity_Kind : unsigned int; |
| 107 |
|
| 108 |
/* Types used for Text Buffer Handling: */ |
| 109 |
|
| 110 |
/* Type used for subscripts in text buffer. */ |
| 111 |
typedef Int Text_Ptr; |
| 112 |
|
| 113 |
/* Text buffer used to hold source file or library information file. */ |
| 114 |
typedef Char *Text_Buffer; |
| 115 |
|
| 116 |
/* Pointer to text buffer. */ |
| 117 |
typedef Char *Text_Buffer_Ptr; |
| 118 |
|
| 119 |
/* Types used for Source Input Handling: */ |
| 120 |
|
| 121 |
/* Line number type, used for storing all line numbers. */ |
| 122 |
typedef Int Line_Number_Type; |
| 123 |
|
| 124 |
/* Column number type, used for storing all column numbers. */ |
| 125 |
typedef Short Column_Number_Type; |
| 126 |
|
| 127 |
/* Type used to store text of a source file. */ |
| 128 |
typedef Text_Buffer Source_Buffer; |
| 129 |
|
| 130 |
/* Pointer to source buffer. */ |
| 131 |
typedef Text_Buffer_Ptr Source_Buffer_Ptr; |
| 132 |
|
| 133 |
/* Type used for source location. */ |
| 134 |
typedef Text_Ptr Source_Ptr; |
| 135 |
|
| 136 |
/* Value used to indicate no source position set. */ |
| 137 |
#define No_Location -1 |
| 138 |
|
| 139 |
/* Used for Sloc in all nodes in the representation of package Standard. */ |
| 140 |
#define Standard_Location -2 |
| 141 |
|
| 142 |
/* Convention identifiers. */ |
| 143 |
enum Convention_Id : Byte; |
| 144 |
|
| 145 |
/* Instance identifiers. */ |
| 146 |
typedef Nat Instance_Id; |
| 147 |
|
| 148 |
/* Type used for union of all possible ID values covering all ranges. */ |
| 149 |
typedef int Union_Id; |
| 150 |
|
| 151 |
/* Range definitions for Tree Data: */ |
| 152 |
|
| 153 |
#define List_Low_Bound -99999999 |
| 154 |
#define List_High_Bound 0 |
| 155 |
|
| 156 |
#define Node_Low_Bound 0 |
| 157 |
#define Node_High_Bound 1999999999 |
| 158 |
/* Above is the correct value of Node_High_Bound for 64-bit machines. It is |
| 159 |
wrong for 32-bit machines, but that doesn't matter. */ |
| 160 |
|
| 161 |
#define Elist_Low_Bound -199999999 |
| 162 |
#define Elist_High_Bound -100000000 |
| 163 |
|
| 164 |
#define Elmt_Low_Bound -299999999 |
| 165 |
#define Elmt_High_Bound -200000000 |
| 166 |
|
| 167 |
#define Names_Low_Bound -399999999 |
| 168 |
#define Names_High_Bound -300000000 |
| 169 |
|
| 170 |
#define Strings_Low_Bound -499999999 |
| 171 |
#define Strings_High_Bound -400000000 |
| 172 |
|
| 173 |
#define Ureal_Low_Bound -599999999 |
| 174 |
#define Ureal_High_Bound -500000000 |
| 175 |
|
| 176 |
#define Uint_Low_Bound -2100000000 |
| 177 |
#define Uint_Table_Start -699999999 |
| 178 |
#define Uint_High_Bound -600000000 |
| 179 |
|
| 180 |
SUBTYPE (List_Range, Int, List_Low_Bound, List_High_Bound) |
| 181 |
SUBTYPE (Node_Range, Int, Node_Low_Bound, Node_High_Bound) |
| 182 |
SUBTYPE (Elist_Range, Int, Elist_Low_Bound, Elist_High_Bound) |
| 183 |
SUBTYPE (Elmt_Range, Int, Elmt_Low_Bound, Elmt_High_Bound) |
| 184 |
SUBTYPE (Names_Range, Int, Names_Low_Bound, Names_High_Bound) |
| 185 |
SUBTYPE (Strings_Range, Int, Strings_Low_Bound, Strings_High_Bound) |
| 186 |
SUBTYPE (Uint_Range, Int, Uint_Low_Bound, Uint_High_Bound) |
| 187 |
SUBTYPE (Ureal_Range, Int, Ureal_Low_Bound, Ureal_High_Bound) |
| 188 |
|
| 189 |
/* Types for Names_Table Package: */ |
| 190 |
|
| 191 |
enum Name_Id : Int; |
| 192 |
|
| 193 |
/* Name_Id value for no name present. */ |
| 194 |
#define No_Name Names_Low_Bound |
| 195 |
|
| 196 |
/* Name_Id value for bad name. */ |
| 197 |
#define Error_Name (Names_Low_Bound + 1) |
| 198 |
|
| 199 |
/* First subscript of names table. */ |
| 200 |
#define First_Name_Id (Names_Low_Bound + 2) |
| 201 |
|
| 202 |
/* Types for Tree Package: */ |
| 203 |
|
| 204 |
/* Subscript of nodes table entry. */ |
| 205 |
typedef Int Node_Id; |
| 206 |
|
| 207 |
/* Used in semantics for Node_Id value referencing an entity. */ |
| 208 |
typedef Node_Id Entity_Id; |
| 209 |
|
| 210 |
/* Null node. */ |
| 211 |
#define Empty 0 |
| 212 |
|
| 213 |
/* Error node. */ |
| 214 |
#define Error 1 |
| 215 |
|
| 216 |
/* Subscript of first allocated node. */ |
| 217 |
#define First_Node_Id Empty |
| 218 |
|
| 219 |
/* Subscript of entry in lists table. */ |
| 220 |
typedef Int List_Id; |
| 221 |
|
| 222 |
/* Indicates absence of a list. */ |
| 223 |
#define No_List 0 |
| 224 |
|
| 225 |
/* Error list. */ |
| 226 |
#define Error_List List_Low_Bound |
| 227 |
|
| 228 |
/* Subscript of first allocated list header. */ |
| 229 |
#define First_List_Id Error_List |
| 230 |
|
| 231 |
/* Element list Id, subscript value of entry in lists table. */ |
| 232 |
typedef Int Elist_Id; |
| 233 |
|
| 234 |
/* Used to indicate absence of an element list. */ |
| 235 |
#define No_Elist Elist_Low_Bound |
| 236 |
|
| 237 |
/* Subscript of first allocated elist header */ |
| 238 |
#define First_Elist_Id (No_Elist + 1) |
| 239 |
|
| 240 |
/* Element Id, subscript value of entry in elements table. */ |
| 241 |
typedef Int Elmt_Id; |
| 242 |
|
| 243 |
/* Used to indicate absence of a list element. */ |
| 244 |
#define No_Elmt Elmt_Low_Bound |
| 245 |
|
| 246 |
/* Subscript of first allocated element */ |
| 247 |
#define First_Elmt_Id (No_Elmt + 1) |
| 248 |
|
| 249 |
/* Types for String_Table Package: */ |
| 250 |
|
| 251 |
/* Subscript of strings table entry. */ |
| 252 |
typedef Int String_Id; |
| 253 |
|
| 254 |
/* Used to indicate missing string Id. */ |
| 255 |
#define No_String Strings_Low_Bound |
| 256 |
|
| 257 |
/* Subscript of first entry in strings table. */ |
| 258 |
#define First_String_Id (No_String + 1) |
| 259 |
|
| 260 |
/* Types for Uint_Support Package: */ |
| 261 |
|
| 262 |
/* Type used for representation of universal integers. */ |
| 263 |
typedef Int Uint; |
| 264 |
typedef Uint Valid_Uint; |
| 265 |
typedef Uint Unat; |
| 266 |
typedef Uint Upos; |
| 267 |
typedef Uint Nonzero_Uint; |
| 268 |
|
| 269 |
/* Used to indicate missing Uint value. */ |
| 270 |
#define No_Uint Uint_Low_Bound |
| 271 |
|
| 272 |
/* Base value used to represent Uint values. */ |
| 273 |
#define Base 32768 |
| 274 |
|
| 275 |
/* Minimum and maximum integers directly representable as Uint values */ |
| 276 |
#define Min_Direct (-(Base - 1)) |
| 277 |
#define Max_Direct ((Base - 1) * (Base - 1)) |
| 278 |
|
| 279 |
#define Uint_Direct_Bias (Uint_Low_Bound + Base) |
| 280 |
#define Uint_Direct_First (Uint_Direct_Bias + Min_Direct) |
| 281 |
#define Uint_Direct_Last (Uint_Direct_Bias + Max_Direct) |
| 282 |
|
| 283 |
/* Define range of direct biased values */ |
| 284 |
SUBTYPE (Uint_Direct, Uint, Uint_Direct_First, Uint_Direct_Last) |
| 285 |
|
| 286 |
/* Constants in Uint format. */ |
| 287 |
#define Uint_0 (Uint_Direct_Bias + 0) |
| 288 |
#define Uint_1 (Uint_Direct_Bias + 1) |
| 289 |
#define Uint_2 (Uint_Direct_Bias + 2) |
| 290 |
#define Uint_10 (Uint_Direct_Bias + 10) |
| 291 |
#define Uint_16 (Uint_Direct_Bias + 16) |
| 292 |
|
| 293 |
#define Uint_Minus_1 (Uint_Direct_Bias - 1) |
| 294 |
|
| 295 |
/* Types for Ureal_Support Package: */ |
| 296 |
|
| 297 |
/* Type used for representation of universal reals. */ |
| 298 |
typedef Int Ureal; |
| 299 |
|
| 300 |
/* Used to indicate missing Uint value. */ |
| 301 |
#define No_Ureal Ureal_Low_Bound |
| 302 |
|
| 303 |
/* Subscript of first entry in Ureal table. */ |
| 304 |
#define Ureal_First_Entry (No_Ureal + 1) |
| 305 |
|
| 306 |
/* Character Code Type: */ |
| 307 |
|
| 308 |
/* Character code value, intended to be 32 bits. */ |
| 309 |
typedef unsigned Char_Code; |
| 310 |
|
| 311 |
/* Types Used for Library Management: */ |
| 312 |
|
| 313 |
/* Unit number. */ |
| 314 |
typedef Int Unit_Number_Type; |
| 315 |
|
| 316 |
/* Unit number value for main unit. */ |
| 317 |
#define Main_Unit 0 |
| 318 |
|
| 319 |
/* Type used to index the source file table. */ |
| 320 |
typedef Nat Source_File_Index; |
| 321 |
|
| 322 |
/* Type used for lines table. */ |
| 323 |
typedef Source_Ptr *Lines_Table_Type; |
| 324 |
|
| 325 |
/* Type used for pointer to lines table. */ |
| 326 |
typedef Source_Ptr *Lines_Table_Ptr; |
| 327 |
|
| 328 |
/* Length of time stamp value. */ |
| 329 |
#define Time_Stamp_Length 22 |
| 330 |
|
| 331 |
/* Type used to represent time stamp. */ |
| 332 |
typedef Char *Time_Stamp_Type; |
| 333 |
|
| 334 |
/* Name_Id synonym used for file names. */ |
| 335 |
typedef Name_Id File_Name_Type; |
| 336 |
|
| 337 |
/* Constant used to indicate no file found. */ |
| 338 |
#define No_File No_Name |
| 339 |
|
| 340 |
/* Name_Id synonym used for unit names. */ |
| 341 |
typedef Name_Id Unit_Name_Type; |
| 342 |
|
| 343 |
/* Definitions for mechanism type and values */ |
| 344 |
typedef Int Mechanism_Type; |
| 345 |
#define Default 0 |
| 346 |
#define By_Copy (-1) |
| 347 |
#define By_Reference (-2) |
| 348 |
#define By_Descriptor (-3) |
| 349 |
#define By_Descriptor_UBS (-4) |
| 350 |
#define By_Descriptor_UBSB (-5) |
| 351 |
#define By_Descriptor_UBA (-6) |
| 352 |
#define By_Descriptor_S (-7) |
| 353 |
#define By_Descriptor_SB (-8) |
| 354 |
#define By_Descriptor_A (-9) |
| 355 |
#define By_Descriptor_NCA (-10) |
| 356 |
#define By_Descriptor_Last (-10) |
| 357 |
#define By_Short_Descriptor (-11) |
| 358 |
#define By_Short_Descriptor_UBS (-12) |
| 359 |
#define By_Short_Descriptor_UBSB (-13) |
| 360 |
#define By_Short_Descriptor_UBA (-14) |
| 361 |
#define By_Short_Descriptor_S (-15) |
| 362 |
#define By_Short_Descriptor_SB (-16) |
| 363 |
#define By_Short_Descriptor_A (-17) |
| 364 |
#define By_Short_Descriptor_NCA (-18) |
| 365 |
#define By_Short_Descriptor_Last (-18) |
| 366 |
|
| 367 |
typedef char Component_Alignment_Kind; |
| 368 |
#define Calign_Default 0 |
| 369 |
#define Calign_Component_Size 1 |
| 370 |
#define Calign_Component_Size_4 2 |
| 371 |
#define Calign_Storage_Unit 3 |
| 372 |
|
| 373 |
typedef char Float_Rep_Kind; |
| 374 |
#define IEEE_Binary 0 |
| 375 |
#define AAMP 1 |
| 376 |
|
| 377 |
typedef Nat Small_Paren_Count_Type; |
| 378 |
|
| 379 |
typedef Nat Field_Offset; |
| 380 |
|
| 381 |
typedef unsigned int any_slot; |
| 382 |
|
| 383 |
#define Slot_Size (sizeof (any_slot) * 8) |
| 384 |
|
| 385 |
/* Slots are 32 bits (for now, but we might want to make that 64). |
| 386 |
The first bootstrap stage uses C++14, so we can only use the 2 argument |
| 387 |
version of static_assert. */ |
| 388 |
static_assert (Slot_Size == 32, ""); |
| 389 |
|
| 390 |
/* Definitions of Reason codes for Raise_xxx_Error nodes. */ |
| 391 |
enum RT_Exception_Code |
| 392 |
{ |
| 393 |
CE_Access_Check_Failed = 0, |
| 394 |
CE_Access_Parameter_Is_Null = 1, |
| 395 |
CE_Discriminant_Check_Failed = 2, |
| 396 |
CE_Divide_By_Zero = 3, |
| 397 |
CE_Explicit_Raise = 4, |
| 398 |
CE_Index_Check_Failed = 5, |
| 399 |
CE_Invalid_Data = 6, |
| 400 |
CE_Length_Check_Failed = 7, |
| 401 |
CE_Null_Exception_Id = 8, |
| 402 |
CE_Null_Not_Allowed = 9, |
| 403 |
|
| 404 |
CE_Overflow_Check_Failed = 10, |
| 405 |
CE_Partition_Check_Failed = 11, |
| 406 |
CE_Range_Check_Failed = 12, |
| 407 |
CE_Tag_Check_Failed = 13, |
| 408 |
PE_Access_Before_Elaboratio = 14, |
| 409 |
PE_Accessibility_Check_Failed = 15, |
| 410 |
PE_Address_Of_Intrinsic = 16, |
| 411 |
PE_Aliased_Parameters = 17, |
| 412 |
PE_All_Guards_Closed = 18, |
| 413 |
PE_Bad_Predicated_Generic_Type = 19, |
| 414 |
|
| 415 |
PE_Current_Task_In_Entry_Body = 20, |
| 416 |
PE_Duplicated_Entry_Address = 21, |
| 417 |
PE_Explicit_Raise = 22, |
| 418 |
PE_Finalize_Raised_Exception = 23, |
| 419 |
PE_Implicit_Return = 24, |
| 420 |
PE_Misaligned_Address_Value = 25, |
| 421 |
PE_Missing_Return = 26, |
| 422 |
PE_Overlaid_Controlled_Object = 27, |
| 423 |
PE_Potentially_Blocking_Operation = 28, |
| 424 |
PE_Stubbed_Subprogram_Called = 29, |
| 425 |
|
| 426 |
PE_Unchecked_Union_Restriction = 30, |
| 427 |
PE_Non_Transportable_Actual = 31, |
| 428 |
SE_Empty_Storage_Pool = 32, |
| 429 |
SE_Explicit_Raise = 33, |
| 430 |
SE_Infinite_Recursion = 34, |
| 431 |
SE_Object_Too_Large = 35, |
| 432 |
PE_Stream_Operation_Not_Allowed = 36, |
| 433 |
PE_Build_In_Place_Mismatch = 37, |
| 434 |
PE_Raise_Check_Failed = 38 |
| 435 |
}; |
| 436 |
|
| 437 |
#define LAST_REASON_CODE 38 |