Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
26 | pmbaty | 1 | /* ACC -- Automatic Compiler Configuration |
2 | |||
3 | Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer |
||
4 | All Rights Reserved. |
||
5 | |||
6 | This software is a copyrighted work licensed under the terms of |
||
7 | the GNU General Public License. Please consult the file "ACC_LICENSE" |
||
8 | for details. |
||
9 | |||
10 | Markus F.X.J. Oberhumer |
||
11 | <markus@oberhumer.com> |
||
12 | http://www.oberhumer.com/ |
||
13 | */ |
||
14 | |||
15 | |||
16 | /*********************************************************************** |
||
17 | // acc_alignof() / acc_inline |
||
18 | ************************************************************************/ |
||
19 | |||
20 | #if (ACC_CC_CILLY || ACC_CC_GNUC || ACC_CC_PGI) |
||
21 | # define acc_alignof(e) __alignof__(e) |
||
22 | #elif (ACC_CC_INTELC && (__INTEL_COMPILER >= 700)) |
||
23 | # define acc_alignof(e) __alignof__(e) |
||
24 | #elif (ACC_CC_MSC && (_MSC_VER >= 1300)) |
||
25 | # define acc_alignof(e) __alignof(e) |
||
26 | #endif |
||
27 | |||
28 | #if (ACC_CC_TURBOC && (__TURBOC__ <= 0x0295)) |
||
29 | #elif defined(__cplusplus) |
||
30 | # define acc_inline inline |
||
31 | #elif (ACC_CC_BORLANDC && (__BORLANDC__ >= 0x0550)) |
||
32 | # define acc_inline __inline |
||
33 | #elif (ACC_CC_CILLY || ACC_CC_GNUC || ACC_CC_PGI) |
||
34 | # define acc_inline __inline__ |
||
35 | #elif (ACC_CC_DMC) |
||
36 | # define acc_inline __inline |
||
37 | #elif (ACC_CC_INTELC) |
||
38 | # define acc_inline __inline |
||
39 | #elif (ACC_CC_MSC && (_MSC_VER >= 900)) |
||
40 | # define acc_inline __inline |
||
41 | #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) |
||
42 | # define acc_inline inline |
||
43 | #endif |
||
44 | |||
45 | |||
46 | /*********************************************************************** |
||
47 | // ACC_UNUSED / ACC_UNUSED_FUNC |
||
48 | ************************************************************************/ |
||
49 | |||
50 | #if !defined(ACC_UNUSED) |
||
51 | # if (ACC_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) |
||
52 | # define ACC_UNUSED(var) ((void) &var) |
||
53 | # elif (ACC_CC_BORLANDC || ACC_CC_HIGHC || ACC_CC_NDPC || ACC_CC_TURBOC) |
||
54 | # define ACC_UNUSED(var) if (&var) ; else |
||
55 | # elif (ACC_CC_MSC && (_MSC_VER < 900)) |
||
56 | # define ACC_UNUSED(var) if (&var) ; else |
||
57 | # elif (ACC_CC_GNUC) |
||
58 | # define ACC_UNUSED(var) ((void) var) |
||
59 | # elif (ACC_CC_KEILC) |
||
60 | # define ACC_UNUSED(var) |
||
61 | # else |
||
62 | # define ACC_UNUSED(var) ((void) &var) |
||
63 | # endif |
||
64 | #endif |
||
65 | #if !defined(ACC_UNUSED_FUNC) |
||
66 | # if (ACC_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) |
||
67 | # define ACC_UNUSED_FUNC(func) ((void) func) |
||
68 | # elif (ACC_CC_BORLANDC || ACC_CC_NDPC || ACC_CC_TURBOC) |
||
69 | # define ACC_UNUSED_FUNC(func) if (func) ; else |
||
70 | # elif (ACC_CC_GNUC == 0x030400ul) && defined(__llvm__) |
||
71 | # define ACC_UNUSED_FUNC(func) ((void) &func) |
||
72 | # elif (ACC_CC_MSC && (_MSC_VER < 900)) |
||
73 | # define ACC_UNUSED_FUNC(func) if (func) ; else |
||
74 | # elif (ACC_CC_MSC) |
||
75 | # define ACC_UNUSED_FUNC(func) ((void) &func) |
||
76 | # elif (ACC_CC_KEILC) |
||
77 | # define ACC_UNUSED_FUNC(func) |
||
78 | # else |
||
79 | # define ACC_UNUSED_FUNC(func) ((void) func) |
||
80 | # endif |
||
81 | #endif |
||
82 | |||
83 | |||
84 | /*********************************************************************** |
||
85 | // compile-time-assertions |
||
86 | ************************************************************************/ |
||
87 | |||
88 | /* This can be put into a header file but may get ignored by some compilers. */ |
||
89 | #if !defined(ACC_COMPILE_TIME_ASSERT_HEADER) |
||
90 | # if (ACC_CC_AZTECC || ACC_CC_ZORTECHC) |
||
91 | # define ACC_COMPILE_TIME_ASSERT_HEADER(e) extern int __acc_cta[1-!(e)]; |
||
92 | # elif (ACC_CC_DMC || ACC_CC_SYMANTECC) |
||
93 | # define ACC_COMPILE_TIME_ASSERT_HEADER(e) extern int __acc_cta[1u-2*!(e)]; |
||
94 | # elif (ACC_CC_TURBOC && (__TURBOC__ == 0x0295)) |
||
95 | # define ACC_COMPILE_TIME_ASSERT_HEADER(e) extern int __acc_cta[1-!(e)]; |
||
96 | # else |
||
97 | # define ACC_COMPILE_TIME_ASSERT_HEADER(e) extern int __acc_cta[1-2*!(e)]; |
||
98 | # endif |
||
99 | #endif |
||
100 | |||
101 | /* This must appear within a function body. */ |
||
102 | #if !defined(ACC_COMPILE_TIME_ASSERT) |
||
103 | # if (ACC_CC_AZTECC) |
||
104 | # define ACC_COMPILE_TIME_ASSERT(e) {typedef int __acc_cta_t[1-!(e)];} |
||
105 | # elif (ACC_CC_DMC || ACC_CC_PACIFICC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC) |
||
106 | # define ACC_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; |
||
107 | # elif (ACC_CC_MSC && (_MSC_VER < 900)) |
||
108 | # define ACC_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; |
||
109 | # elif (ACC_CC_TURBOC && (__TURBOC__ == 0x0295)) |
||
110 | # define ACC_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; |
||
111 | # else |
||
112 | # define ACC_COMPILE_TIME_ASSERT(e) {typedef int __acc_cta_t[1-2*!(e)];} |
||
113 | # endif |
||
114 | #endif |
||
115 | |||
116 | |||
117 | /*********************************************************************** |
||
118 | // macros |
||
119 | ************************************************************************/ |
||
120 | |||
121 | #if !defined(__ACC_UINT_MAX) |
||
122 | # define __ACC_INT_MAX(b) ((((1l << ((b)-2)) - 1l) * 2l) + 1l) |
||
123 | # define __ACC_UINT_MAX(b) ((((1ul << ((b)-1)) - 1ul) * 2ul) + 1ul) |
||
124 | #endif |
||
125 | |||
126 | |||
127 | /*********************************************************************** |
||
128 | // get sizes of builtin integral types from <limits.h> |
||
129 | ************************************************************************/ |
||
130 | |||
131 | #if !defined(__ACC_SHORT_BIT) |
||
132 | # if (USHRT_MAX == ACC_0xffffL) |
||
133 | # define __ACC_SHORT_BIT 16 |
||
134 | # elif (USHRT_MAX == ACC_0xffffffffL) |
||
135 | # define __ACC_SHORT_BIT 32 |
||
136 | # elif (USHRT_MAX == __ACC_UINT_MAX(64)) |
||
137 | # define __ACC_SHORT_BIT 64 |
||
138 | # elif (USHRT_MAX == __ACC_UINT_MAX(128)) |
||
139 | # define __ACC_SHORT_BIT 128 |
||
140 | # else |
||
141 | # error "check your compiler installation: USHRT_MAX" |
||
142 | # endif |
||
143 | #endif |
||
144 | |||
145 | #if !defined(__ACC_INT_BIT) |
||
146 | # if (UINT_MAX == ACC_0xffffL) |
||
147 | # define __ACC_INT_BIT 16 |
||
148 | # elif (UINT_MAX == ACC_0xffffffffL) |
||
149 | # define __ACC_INT_BIT 32 |
||
150 | # elif (UINT_MAX == __ACC_UINT_MAX(64)) |
||
151 | # define __ACC_INT_BIT 64 |
||
152 | # elif (UINT_MAX == __ACC_UINT_MAX(128)) |
||
153 | # define __ACC_INT_BIT 128 |
||
154 | # else |
||
155 | # error "check your compiler installation: UINT_MAX" |
||
156 | # endif |
||
157 | #endif |
||
158 | |||
159 | #if !defined(__ACC_LONG_BIT) |
||
160 | # if (ULONG_MAX == ACC_0xffffffffL) |
||
161 | # define __ACC_LONG_BIT 32 |
||
162 | # elif (ULONG_MAX == __ACC_UINT_MAX(64)) |
||
163 | # define __ACC_LONG_BIT 64 |
||
164 | # elif (ULONG_MAX == __ACC_UINT_MAX(128)) |
||
165 | # define __ACC_LONG_BIT 128 |
||
166 | # else |
||
167 | # error "check your compiler installation: ULONG_MAX" |
||
168 | # endif |
||
169 | #endif |
||
170 | |||
171 | |||
172 | /*********************************************************************** |
||
173 | // acc_auto.h supplements |
||
174 | ************************************************************************/ |
||
175 | |||
176 | #if (ACC_OS_CYGWIN || (ACC_OS_EMX && defined(__RSXNT__)) || ACC_OS_WIN32 || ACC_OS_WIN64) |
||
177 | # if (ACC_CC_WATCOMC && (__WATCOMC__ < 1000)) |
||
178 | # elif (ACC_OS_WIN32 && ACC_CC_GNUC) && defined(__PW32__) |
||
179 | /* ancient pw32 version */ |
||
180 | # elif ((ACC_OS_CYGWIN || defined(__MINGW32__)) && (ACC_CC_GNUC && (ACC_CC_GNUC < 0x025f00ul))) |
||
181 | /* ancient cygwin/mingw version */ |
||
182 | # else |
||
183 | # define ACC_HAVE_WINDOWS_H 1 |
||
184 | # endif |
||
185 | #endif |
||
186 | |||
187 | |||
188 | |||
189 | /* |
||
190 | vi:ts=4:et |
||
191 | */ |