Chris@16
|
1 // Copyright David Abrahams 2002.
|
Chris@16
|
2 // Distributed under the Boost Software License, Version 1.0. (See
|
Chris@16
|
3 // accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
4 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
5 #ifndef WORKAROUND_DWA2002126_HPP
|
Chris@16
|
6 # define WORKAROUND_DWA2002126_HPP
|
Chris@16
|
7
|
Chris@16
|
8 // Compiler/library version workaround macro
|
Chris@16
|
9 //
|
Chris@16
|
10 // Usage:
|
Chris@16
|
11 //
|
Chris@16
|
12 // #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
Chris@16
|
13 // // workaround for eVC4 and VC6
|
Chris@16
|
14 // ... // workaround code here
|
Chris@16
|
15 // #endif
|
Chris@16
|
16 //
|
Chris@16
|
17 // When BOOST_STRICT_CONFIG is defined, expands to 0. Otherwise, the
|
Chris@16
|
18 // first argument must be undefined or expand to a numeric
|
Chris@16
|
19 // value. The above expands to:
|
Chris@16
|
20 //
|
Chris@16
|
21 // (BOOST_MSVC) != 0 && (BOOST_MSVC) < 1300
|
Chris@16
|
22 //
|
Chris@16
|
23 // When used for workarounds that apply to the latest known version
|
Chris@16
|
24 // and all earlier versions of a compiler, the following convention
|
Chris@16
|
25 // should be observed:
|
Chris@16
|
26 //
|
Chris@16
|
27 // #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1301))
|
Chris@16
|
28 //
|
Chris@16
|
29 // The version number in this case corresponds to the last version in
|
Chris@16
|
30 // which the workaround was known to have been required. When
|
Chris@16
|
31 // BOOST_DETECT_OUTDATED_WORKAROUNDS is not the defined, the macro
|
Chris@16
|
32 // BOOST_TESTED_AT(x) expands to "!= 0", which effectively activates
|
Chris@16
|
33 // the workaround for any version of the compiler. When
|
Chris@16
|
34 // BOOST_DETECT_OUTDATED_WORKAROUNDS is defined, a compiler warning or
|
Chris@16
|
35 // error will be issued if the compiler version exceeds the argument
|
Chris@16
|
36 // to BOOST_TESTED_AT(). This can be used to locate workarounds which
|
Chris@16
|
37 // may be obsoleted by newer versions.
|
Chris@16
|
38
|
Chris@16
|
39 # ifndef BOOST_STRICT_CONFIG
|
Chris@16
|
40
|
Chris@16
|
41 #include <boost/config.hpp>
|
Chris@16
|
42
|
Chris@16
|
43 #ifndef __BORLANDC__
|
Chris@16
|
44 #define __BORLANDC___WORKAROUND_GUARD 1
|
Chris@16
|
45 #else
|
Chris@16
|
46 #define __BORLANDC___WORKAROUND_GUARD 0
|
Chris@16
|
47 #endif
|
Chris@16
|
48 #ifndef __CODEGEARC__
|
Chris@16
|
49 #define __CODEGEARC___WORKAROUND_GUARD 1
|
Chris@16
|
50 #else
|
Chris@16
|
51 #define __CODEGEARC___WORKAROUND_GUARD 0
|
Chris@16
|
52 #endif
|
Chris@16
|
53 #ifndef _MSC_VER
|
Chris@16
|
54 #define _MSC_VER_WORKAROUND_GUARD 1
|
Chris@16
|
55 #else
|
Chris@16
|
56 #define _MSC_VER_WORKAROUND_GUARD 0
|
Chris@16
|
57 #endif
|
Chris@16
|
58 #ifndef _MSC_FULL_VER
|
Chris@16
|
59 #define _MSC_FULL_VER_WORKAROUND_GUARD 1
|
Chris@16
|
60 #else
|
Chris@16
|
61 #define _MSC_FULL_VER_WORKAROUND_GUARD 0
|
Chris@16
|
62 #endif
|
Chris@16
|
63 #ifndef BOOST_MSVC
|
Chris@16
|
64 #define BOOST_MSVC_WORKAROUND_GUARD 1
|
Chris@16
|
65 #else
|
Chris@16
|
66 #define BOOST_MSVC_WORKAROUND_GUARD 0
|
Chris@16
|
67 #endif
|
Chris@16
|
68 #ifndef BOOST_MSVC_FULL_VER
|
Chris@16
|
69 #define BOOST_MSVC_FULL_VER_WORKAROUND_GUARD 1
|
Chris@16
|
70 #else
|
Chris@16
|
71 #define BOOST_MSVC_FULL_VER_WORKAROUND_GUARD 0
|
Chris@16
|
72 #endif
|
Chris@16
|
73 #ifndef __GNUC__
|
Chris@16
|
74 #define __GNUC___WORKAROUND_GUARD 1
|
Chris@16
|
75 #else
|
Chris@16
|
76 #define __GNUC___WORKAROUND_GUARD 0
|
Chris@16
|
77 #endif
|
Chris@16
|
78 #ifndef __GNUC_MINOR__
|
Chris@16
|
79 #define __GNUC_MINOR___WORKAROUND_GUARD 1
|
Chris@16
|
80 #else
|
Chris@16
|
81 #define __GNUC_MINOR___WORKAROUND_GUARD 0
|
Chris@16
|
82 #endif
|
Chris@16
|
83 #ifndef __GNUC_PATCHLEVEL__
|
Chris@16
|
84 #define __GNUC_PATCHLEVEL___WORKAROUND_GUARD 1
|
Chris@16
|
85 #else
|
Chris@16
|
86 #define __GNUC_PATCHLEVEL___WORKAROUND_GUARD 0
|
Chris@16
|
87 #endif
|
Chris@16
|
88 #ifndef __IBMCPP__
|
Chris@16
|
89 #define __IBMCPP___WORKAROUND_GUARD 1
|
Chris@16
|
90 #else
|
Chris@16
|
91 #define __IBMCPP___WORKAROUND_GUARD 0
|
Chris@16
|
92 #endif
|
Chris@16
|
93 #ifndef __SUNPRO_CC
|
Chris@16
|
94 #define __SUNPRO_CC_WORKAROUND_GUARD 1
|
Chris@16
|
95 #else
|
Chris@16
|
96 #define __SUNPRO_CC_WORKAROUND_GUARD 0
|
Chris@16
|
97 #endif
|
Chris@16
|
98 #ifndef __DECCXX_VER
|
Chris@16
|
99 #define __DECCXX_VER_WORKAROUND_GUARD 1
|
Chris@16
|
100 #else
|
Chris@16
|
101 #define __DECCXX_VER_WORKAROUND_GUARD 0
|
Chris@16
|
102 #endif
|
Chris@16
|
103 #ifndef __MWERKS__
|
Chris@16
|
104 #define __MWERKS___WORKAROUND_GUARD 1
|
Chris@16
|
105 #else
|
Chris@16
|
106 #define __MWERKS___WORKAROUND_GUARD 0
|
Chris@16
|
107 #endif
|
Chris@16
|
108 #ifndef __EDG__
|
Chris@16
|
109 #define __EDG___WORKAROUND_GUARD 1
|
Chris@16
|
110 #else
|
Chris@16
|
111 #define __EDG___WORKAROUND_GUARD 0
|
Chris@16
|
112 #endif
|
Chris@16
|
113 #ifndef __EDG_VERSION__
|
Chris@16
|
114 #define __EDG_VERSION___WORKAROUND_GUARD 1
|
Chris@16
|
115 #else
|
Chris@16
|
116 #define __EDG_VERSION___WORKAROUND_GUARD 0
|
Chris@16
|
117 #endif
|
Chris@16
|
118 #ifndef __HP_aCC
|
Chris@16
|
119 #define __HP_aCC_WORKAROUND_GUARD 1
|
Chris@16
|
120 #else
|
Chris@16
|
121 #define __HP_aCC_WORKAROUND_GUARD 0
|
Chris@16
|
122 #endif
|
Chris@16
|
123 #ifndef __hpxstd98
|
Chris@16
|
124 #define __hpxstd98_WORKAROUND_GUARD 1
|
Chris@16
|
125 #else
|
Chris@16
|
126 #define __hpxstd98_WORKAROUND_GUARD 0
|
Chris@16
|
127 #endif
|
Chris@16
|
128 #ifndef _CRAYC
|
Chris@16
|
129 #define _CRAYC_WORKAROUND_GUARD 1
|
Chris@16
|
130 #else
|
Chris@16
|
131 #define _CRAYC_WORKAROUND_GUARD 0
|
Chris@16
|
132 #endif
|
Chris@16
|
133 #ifndef __DMC__
|
Chris@16
|
134 #define __DMC___WORKAROUND_GUARD 1
|
Chris@16
|
135 #else
|
Chris@16
|
136 #define __DMC___WORKAROUND_GUARD 0
|
Chris@16
|
137 #endif
|
Chris@16
|
138 #ifndef MPW_CPLUS
|
Chris@16
|
139 #define MPW_CPLUS_WORKAROUND_GUARD 1
|
Chris@16
|
140 #else
|
Chris@16
|
141 #define MPW_CPLUS_WORKAROUND_GUARD 0
|
Chris@16
|
142 #endif
|
Chris@16
|
143 #ifndef __COMO__
|
Chris@16
|
144 #define __COMO___WORKAROUND_GUARD 1
|
Chris@16
|
145 #else
|
Chris@16
|
146 #define __COMO___WORKAROUND_GUARD 0
|
Chris@16
|
147 #endif
|
Chris@16
|
148 #ifndef __COMO_VERSION__
|
Chris@16
|
149 #define __COMO_VERSION___WORKAROUND_GUARD 1
|
Chris@16
|
150 #else
|
Chris@16
|
151 #define __COMO_VERSION___WORKAROUND_GUARD 0
|
Chris@16
|
152 #endif
|
Chris@16
|
153 #ifndef __INTEL_COMPILER
|
Chris@16
|
154 #define __INTEL_COMPILER_WORKAROUND_GUARD 1
|
Chris@16
|
155 #else
|
Chris@16
|
156 #define __INTEL_COMPILER_WORKAROUND_GUARD 0
|
Chris@16
|
157 #endif
|
Chris@16
|
158 #ifndef __ICL
|
Chris@16
|
159 #define __ICL_WORKAROUND_GUARD 1
|
Chris@16
|
160 #else
|
Chris@16
|
161 #define __ICL_WORKAROUND_GUARD 0
|
Chris@16
|
162 #endif
|
Chris@16
|
163 #ifndef _COMPILER_VERSION
|
Chris@16
|
164 #define _COMPILER_VERSION_WORKAROUND_GUARD 1
|
Chris@16
|
165 #else
|
Chris@16
|
166 #define _COMPILER_VERSION_WORKAROUND_GUARD 0
|
Chris@16
|
167 #endif
|
Chris@16
|
168
|
Chris@16
|
169 #ifndef _RWSTD_VER
|
Chris@16
|
170 #define _RWSTD_VER_WORKAROUND_GUARD 1
|
Chris@16
|
171 #else
|
Chris@16
|
172 #define _RWSTD_VER_WORKAROUND_GUARD 0
|
Chris@16
|
173 #endif
|
Chris@16
|
174 #ifndef BOOST_RWSTD_VER
|
Chris@16
|
175 #define BOOST_RWSTD_VER_WORKAROUND_GUARD 1
|
Chris@16
|
176 #else
|
Chris@16
|
177 #define BOOST_RWSTD_VER_WORKAROUND_GUARD 0
|
Chris@16
|
178 #endif
|
Chris@16
|
179 #ifndef __GLIBCPP__
|
Chris@16
|
180 #define __GLIBCPP___WORKAROUND_GUARD 1
|
Chris@16
|
181 #else
|
Chris@16
|
182 #define __GLIBCPP___WORKAROUND_GUARD 0
|
Chris@16
|
183 #endif
|
Chris@16
|
184 #ifndef _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
|
Chris@16
|
185 #define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC_WORKAROUND_GUARD 1
|
Chris@16
|
186 #else
|
Chris@16
|
187 #define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC_WORKAROUND_GUARD 0
|
Chris@16
|
188 #endif
|
Chris@16
|
189 #ifndef __SGI_STL_PORT
|
Chris@16
|
190 #define __SGI_STL_PORT_WORKAROUND_GUARD 1
|
Chris@16
|
191 #else
|
Chris@16
|
192 #define __SGI_STL_PORT_WORKAROUND_GUARD 0
|
Chris@16
|
193 #endif
|
Chris@16
|
194 #ifndef _STLPORT_VERSION
|
Chris@16
|
195 #define _STLPORT_VERSION_WORKAROUND_GUARD 1
|
Chris@16
|
196 #else
|
Chris@16
|
197 #define _STLPORT_VERSION_WORKAROUND_GUARD 0
|
Chris@16
|
198 #endif
|
Chris@16
|
199 #ifndef __LIBCOMO_VERSION__
|
Chris@16
|
200 #define __LIBCOMO_VERSION___WORKAROUND_GUARD 1
|
Chris@16
|
201 #else
|
Chris@16
|
202 #define __LIBCOMO_VERSION___WORKAROUND_GUARD 0
|
Chris@16
|
203 #endif
|
Chris@16
|
204 #ifndef _CPPLIB_VER
|
Chris@16
|
205 #define _CPPLIB_VER_WORKAROUND_GUARD 1
|
Chris@16
|
206 #else
|
Chris@16
|
207 #define _CPPLIB_VER_WORKAROUND_GUARD 0
|
Chris@16
|
208 #endif
|
Chris@16
|
209
|
Chris@16
|
210 #ifndef BOOST_INTEL_CXX_VERSION
|
Chris@16
|
211 #define BOOST_INTEL_CXX_VERSION_WORKAROUND_GUARD 1
|
Chris@16
|
212 #else
|
Chris@16
|
213 #define BOOST_INTEL_CXX_VERSION_WORKAROUND_GUARD 0
|
Chris@16
|
214 #endif
|
Chris@16
|
215 #ifndef BOOST_INTEL_WIN
|
Chris@16
|
216 #define BOOST_INTEL_WIN_WORKAROUND_GUARD 1
|
Chris@16
|
217 #else
|
Chris@16
|
218 #define BOOST_INTEL_WIN_WORKAROUND_GUARD 0
|
Chris@16
|
219 #endif
|
Chris@16
|
220 #ifndef BOOST_DINKUMWARE_STDLIB
|
Chris@16
|
221 #define BOOST_DINKUMWARE_STDLIB_WORKAROUND_GUARD 1
|
Chris@16
|
222 #else
|
Chris@16
|
223 #define BOOST_DINKUMWARE_STDLIB_WORKAROUND_GUARD 0
|
Chris@16
|
224 #endif
|
Chris@16
|
225 #ifndef BOOST_INTEL
|
Chris@16
|
226 #define BOOST_INTEL_WORKAROUND_GUARD 1
|
Chris@16
|
227 #else
|
Chris@16
|
228 #define BOOST_INTEL_WORKAROUND_GUARD 0
|
Chris@16
|
229 #endif
|
Chris@16
|
230 // Always define to zero, if it's used it'll be defined my MPL:
|
Chris@16
|
231 #define BOOST_MPL_CFG_GCC_WORKAROUND_GUARD 0
|
Chris@16
|
232
|
Chris@16
|
233 # define BOOST_WORKAROUND(symbol, test) \
|
Chris@16
|
234 ((symbol ## _WORKAROUND_GUARD + 0 == 0) && \
|
Chris@16
|
235 (symbol != 0) && (1 % (( (symbol test) ) + 1)))
|
Chris@16
|
236 // ^ ^ ^ ^
|
Chris@16
|
237 // The extra level of parenthesis nesting above, along with the
|
Chris@16
|
238 // BOOST_OPEN_PAREN indirection below, is required to satisfy the
|
Chris@16
|
239 // broken preprocessor in MWCW 8.3 and earlier.
|
Chris@16
|
240 //
|
Chris@16
|
241 // The basic mechanism works as follows:
|
Chris@16
|
242 // (symbol test) + 1 => if (symbol test) then 2 else 1
|
Chris@16
|
243 // 1 % ((symbol test) + 1) => if (symbol test) then 1 else 0
|
Chris@16
|
244 //
|
Chris@16
|
245 // The complication with % is for cooperation with BOOST_TESTED_AT().
|
Chris@16
|
246 // When "test" is BOOST_TESTED_AT(x) and
|
Chris@16
|
247 // BOOST_DETECT_OUTDATED_WORKAROUNDS is #defined,
|
Chris@16
|
248 //
|
Chris@16
|
249 // symbol test => if (symbol <= x) then 1 else -1
|
Chris@16
|
250 // (symbol test) + 1 => if (symbol <= x) then 2 else 0
|
Chris@16
|
251 // 1 % ((symbol test) + 1) => if (symbol <= x) then 1 else divide-by-zero
|
Chris@16
|
252 //
|
Chris@16
|
253
|
Chris@16
|
254 # ifdef BOOST_DETECT_OUTDATED_WORKAROUNDS
|
Chris@16
|
255 # define BOOST_OPEN_PAREN (
|
Chris@16
|
256 # define BOOST_TESTED_AT(value) > value) ?(-1): BOOST_OPEN_PAREN 1
|
Chris@16
|
257 # else
|
Chris@16
|
258 # define BOOST_TESTED_AT(value) != ((value)-(value))
|
Chris@16
|
259 # endif
|
Chris@16
|
260
|
Chris@16
|
261 # else
|
Chris@16
|
262
|
Chris@16
|
263 # define BOOST_WORKAROUND(symbol, test) 0
|
Chris@16
|
264
|
Chris@16
|
265 # endif
|
Chris@16
|
266
|
Chris@16
|
267 #endif // WORKAROUND_DWA2002126_HPP
|