OSDN Git Service

Add fix test from irix_stdio_dummy_va_list
[pf3gnuchains/gcc-fork.git] / gcc / hwint.h
1 /* HOST_WIDE_INT definitions for the GNU compiler.
2    Copyright (C) 1998 Free Software Foundation, Inc.
3
4    This file is part of GNU CC.
5
6    Provide definitions for macros which depend on HOST_BITS_PER_INT
7    and HOST_BITS_PER_LONG. */
8
9 #ifndef GCC_HWINT_H
10 #define GCC_HWINT_H
11
12 /* This describes the machine the compiler is hosted on.  */
13 #define HOST_BITS_PER_CHAR  CHAR_BIT
14 #define HOST_BITS_PER_SHORT (CHAR_BIT * SIZEOF_SHORT)
15 #define HOST_BITS_PER_INT   (CHAR_BIT * SIZEOF_INT)
16 #define HOST_BITS_PER_LONG  (CHAR_BIT * SIZEOF_LONG)
17
18 #ifdef HAVE_LONG_LONG
19 # define HOST_BITS_PER_LONGLONG (CHAR_BIT * SIZEOF_LONG_LONG)
20 #else
21 /* If we're here and we're GCC, assume this is stage 2+ of a bootstrap
22    and 'long long' has the width of the *target*'s long long.  */
23 # if GCC_VERSION > 3000
24 #  define HOST_BITS_PER_LONGLONG LONG_LONG_TYPE_SIZE
25 # endif /* gcc */
26 #endif /* no long long */
27
28 /* Find the largest host integer type and set its size and type.  */
29
30 /* Use long long on the host if the target has a wider long type than
31    the host.  */
32
33 #if ! defined HOST_BITS_PER_WIDE_INT \
34     && defined HOST_BITS_PER_LONGLONG \
35     && (HOST_BITS_PER_LONGLONG > HOST_BITS_PER_LONG) \
36     && (defined (LONG_LONG_MAX) || defined (LONGLONG_MAX) \
37         || defined (LLONG_MAX) || defined (__GNUC__))
38
39 # ifdef MAX_LONG_TYPE_SIZE
40 #  if MAX_LONG_TYPE_SIZE > HOST_BITS_PER_LONG
41 #   define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONGLONG
42 #   define HOST_WIDE_INT long long
43 #  endif
44 # else
45 #  if LONG_TYPE_SIZE > HOST_BITS_PER_LONG
46 #   define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONGLONG
47 #   define HOST_WIDE_INT long long
48 #  endif
49 # endif
50
51 #endif
52
53 #ifndef HOST_BITS_PER_WIDE_INT
54
55 # if HOST_BITS_PER_LONG > HOST_BITS_PER_INT
56 #  define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
57 #  define HOST_WIDE_INT long
58 # else
59 #  define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT
60 #  define HOST_WIDE_INT int
61 # endif
62
63 #endif /* ! HOST_BITS_PER_WIDE_INT */
64
65 /* Provide defaults for the way to print a HOST_WIDE_INT
66    in various manners.  */
67
68 #ifndef HOST_WIDE_INT_PRINT_DEC
69 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
70 #  define HOST_WIDE_INT_PRINT_DEC "%d"
71 # else
72 #  if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
73 #   define HOST_WIDE_INT_PRINT_DEC "%ld"
74 #  else
75 #   define HOST_WIDE_INT_PRINT_DEC "%lld"
76 #  endif
77 # endif
78 #endif /* ! HOST_WIDE_INT_PRINT_DEC */
79
80 #ifndef HOST_WIDE_INT_PRINT_UNSIGNED
81 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
82 #  define HOST_WIDE_INT_PRINT_UNSIGNED "%u"
83 # else
84 #  if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
85 #   define HOST_WIDE_INT_PRINT_UNSIGNED "%lu"
86 #  else
87 #   define HOST_WIDE_INT_PRINT_UNSIGNED "%llu"
88 #  endif
89 # endif
90 #endif /* ! HOST_WIDE_INT_PRINT_UNSIGNED */
91
92 #ifndef HOST_WIDE_INT_PRINT_HEX
93 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
94 #  define HOST_WIDE_INT_PRINT_HEX "0x%x"
95 # else
96 #  if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
97 #   define HOST_WIDE_INT_PRINT_HEX "0x%lx"
98 #  else
99 #   define HOST_WIDE_INT_PRINT_HEX "0x%llx"
100 #  endif
101 # endif
102 #endif /* ! HOST_WIDE_INT_PRINT_HEX */
103
104 #ifndef HOST_WIDE_INT_PRINT_DOUBLE_HEX
105 # if HOST_BITS_PER_WIDE_INT == 64
106 #  if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
107 #   define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%x%016x"
108 #  else
109 #   if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
110 #    define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%016lx"
111 #   else
112 #    define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%016llx"
113 #   endif
114 #  endif
115 # else
116 #  if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
117 #   define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%x%08x"
118 #  else
119 #   if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
120 #    define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%08lx"
121 #   else
122 #    define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%08llx"
123 #   endif
124 #  endif
125 # endif
126 #endif /* ! HOST_WIDE_INT_PRINT_DOUBLE_HEX */
127
128 /* Find HOST_WIDEST_INT and set its bit size, type and print macros.
129    It will be the largest integer mode supported by the host which may
130    (or may not) be larger than HOST_WIDE_INT.  */
131
132 #ifndef HOST_WIDEST_INT
133 #if defined HOST_BITS_PER_LONGLONG \
134     && HOST_BITS_PER_LONGLONG > HOST_BITS_PER_LONG
135 #   define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONGLONG
136 #   define HOST_WIDEST_INT long long
137 #   define HOST_WIDEST_INT_PRINT_DEC "%lld"
138 #   define HOST_WIDEST_INT_PRINT_UNSIGNED "%llu"
139 #   define HOST_WIDEST_INT_PRINT_HEX "0x%llx"
140 #  else
141 #   define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONG
142 #   define HOST_WIDEST_INT long
143 #   define HOST_WIDEST_INT_PRINT_DEC "%ld"
144 #   define HOST_WIDEST_INT_PRINT_UNSIGNED "%lu"
145 #   define HOST_WIDEST_INT_PRINT_HEX "0x%lx"
146 # endif /* long long wider than long */
147 #endif /* ! HOST_WIDEST_INT */
148
149 #endif /* ! GCC_HWINT_H */