Fix Ada runtime library breakage on Solaris
[official-gcc.git] / gcc / ada / get_targ.ads
blob8bdf6066d49447633724202551e594791f0766ba
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- G E T _ T A R G --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2024, 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 ------------------------------------------------------------------------------
26 -- This package provides an Import to the C functions which provide
27 -- values related to types on the target system. It is only needed for
28 -- exp_dbug and the elaboration of ttypes, via the Set_Targs package.
29 -- It also contains the routine for registering floating-point types.
31 -- NOTE: Any changes in this package must be reflected in aa_getta.adb
32 -- and any other version in the various back ends.
34 -- Note that all these values return sizes of C types with corresponding
35 -- names. This allows GNAT to define the corresponding Ada types to have
36 -- the same representation. There is one exception to this general rule:
37 -- the Wide_Character_Type uses twice the size of a C char, instead of the
38 -- size of wchar_t.
40 with Types; use Types;
42 package Get_Targ is
44 -- Functions returning individual runtime values
46 function Get_Bits_Per_Unit return Pos;
47 -- System.Storage_Unit
49 function Get_Bits_Per_Word return Pos;
50 -- System.Word_Size
52 function Get_Char_Size return Pos;
53 -- Size of Standard.Character
55 function Get_Wchar_T_Size return Pos;
56 -- Size of Interfaces.C.wchar_t
58 function Get_Short_Size return Pos;
59 -- Size of Standard.Short_Integer
61 function Get_Int_Size return Pos;
62 -- Size of Standard.Integer
64 function Get_Long_Size return Pos;
65 -- Size of Standard.Long_Integer
67 function Get_Long_Long_Size return Pos;
68 -- Size of Standard.Long_Long_Integer
70 function Get_Long_Long_Long_Size return Pos;
71 -- Size of Standard.Long_Long_Long_Integer
73 function Get_Pointer_Size return Pos;
74 -- Size of System.Address
76 function Get_Maximum_Alignment return Pos;
77 -- Maximum supported alignment
79 function Get_Float_Words_BE return Nat;
80 -- Non-zero iff float words big endian
82 function Get_Words_BE return Nat;
83 -- Non-zero iff integer words big endian
85 function Get_Bytes_BE return Nat;
86 -- Non-zero iff bytes big-endian
88 function Get_Bits_BE return Nat;
89 -- Non-zero iff bit order big endian
91 function Get_Strict_Alignment return Nat;
92 -- Non-zero if target requires strict alignent
94 function Get_System_Allocator_Alignment return Nat;
95 -- Alignment guaranteed by malloc falls
97 function Get_Double_Float_Alignment return Nat;
98 -- Alignment required for Long_Float or 0 if no special requirement
100 function Get_Double_Scalar_Alignment return Nat;
101 -- Alignment required for Long_Long_Integer or larger integer types
102 -- or 0 if no special requirement.
104 function Get_Short_Enums return Int;
105 -- Returns non-zero if we are in short enums mode, where foreign convention
106 -- (in particular C and C++) enumeration types will be sized as in Ada,
107 -- using the shortest possibility from 8,16,32 bits, signed or unsigned.
108 -- A zero value means Short_Enums are not in use, and in this case all
109 -- foreign convention enumeration types are given the same size as c int.
111 -- Other subprograms
113 type C_String is array (0 .. 255) of aliased Character;
114 pragma Convention (C, C_String);
116 type Register_Type_Proc is access procedure
117 (C_Name : C_String; -- Nul-terminated string with name of type
118 Digs : Natural; -- Digits for floating point, 0 otherwise
119 Complex : Boolean; -- True iff type has real and imaginary parts
120 Count : Natural; -- Number of elements in vector, 0 otherwise
121 Float_Rep : Float_Rep_Kind; -- Representation used for fpt type
122 Precision : Positive; -- Precision of representation in bits
123 Size : Positive; -- Size of representation in bits
124 Alignment : Natural); -- Required alignment in bits
125 pragma Convention (C, Register_Type_Proc);
126 -- Call back procedure for Register_Back_End_Types. This is to be used by
127 -- Create_Standard to create predefined types for all types supported by
128 -- the back end.
130 procedure Register_Back_End_Types (Call_Back : Register_Type_Proc);
131 -- Calls the Call_Back function with information for each supported type
133 function Get_Back_End_Config_File return String_Ptr;
134 -- Return the back end configuration file, or null if none. If non-null,
135 -- this file should be used instead of calling the various Get_xxx
136 -- functions in this package.
138 end Get_Targ;