1 // Copyright David Abrahams 2002.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 #ifndef BOOST_CONFIG_WORKAROUND_HPP
6 #define BOOST_CONFIG_WORKAROUND_HPP
8 // Compiler/library version workaround macro
12 // #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
13 // // workaround for eVC4 and VC6
14 // ... // workaround code here
17 // When BOOST_STRICT_CONFIG is defined, expands to 0. Otherwise, the
18 // first argument must be undefined or expand to a numeric
19 // value. The above expands to:
21 // (BOOST_MSVC) != 0 && (BOOST_MSVC) < 1300
23 // When used for workarounds that apply to the latest known version
24 // and all earlier versions of a compiler, the following convention
25 // should be observed:
27 // #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1301))
29 // The version number in this case corresponds to the last version in
30 // which the workaround was known to have been required. When
31 // BOOST_DETECT_OUTDATED_WORKAROUNDS is not the defined, the macro
32 // BOOST_TESTED_AT(x) expands to "!= 0", which effectively activates
33 // the workaround for any version of the compiler. When
34 // BOOST_DETECT_OUTDATED_WORKAROUNDS is defined, a compiler warning or
35 // error will be issued if the compiler version exceeds the argument
36 // to BOOST_TESTED_AT(). This can be used to locate workarounds which
37 // may be obsoleted by newer versions.
39 #ifndef BOOST_STRICT_CONFIG
41 #include <boost/config.hpp>
44 #define __BORLANDC___WORKAROUND_GUARD 1
46 #define __BORLANDC___WORKAROUND_GUARD 0
49 #define __CODEGEARC___WORKAROUND_GUARD 1
51 #define __CODEGEARC___WORKAROUND_GUARD 0
53 #ifndef BOOST_BORLANDC
54 #define BOOST_BORLANDC_WORKAROUND_GUARD 1
56 #define BOOST_BORLANDC_WORKAROUND_GUARD 0
58 #ifndef BOOST_CODEGEARC
59 #define BOOST_CODEGEARC_WORKAROUND_GUARD 1
61 #define BOOST_CODEGEARC_WORKAROUND_GUARD 0
64 #define BOOST_EMBTC_WORKAROUND_GUARD 1
66 #define BOOST_EMBTC_WORKAROUND_GUARD 0
69 #define _MSC_VER_WORKAROUND_GUARD 1
71 #define _MSC_VER_WORKAROUND_GUARD 0
74 #define _MSC_FULL_VER_WORKAROUND_GUARD 1
76 #define _MSC_FULL_VER_WORKAROUND_GUARD 0
79 #define BOOST_MSVC_WORKAROUND_GUARD 1
81 #define BOOST_MSVC_WORKAROUND_GUARD 0
83 #ifndef BOOST_MSVC_FULL_VER
84 #define BOOST_MSVC_FULL_VER_WORKAROUND_GUARD 1
86 #define BOOST_MSVC_FULL_VER_WORKAROUND_GUARD 0
89 #define __GNUC___WORKAROUND_GUARD 1
91 #define __GNUC___WORKAROUND_GUARD 0
93 #ifndef __GNUC_MINOR__
94 #define __GNUC_MINOR___WORKAROUND_GUARD 1
96 #define __GNUC_MINOR___WORKAROUND_GUARD 0
98 #ifndef __GNUC_PATCHLEVEL__
99 #define __GNUC_PATCHLEVEL___WORKAROUND_GUARD 1
101 #define __GNUC_PATCHLEVEL___WORKAROUND_GUARD 0
104 #define BOOST_GCC_WORKAROUND_GUARD 1
105 #define BOOST_GCC_VERSION_WORKAROUND_GUARD 1
107 #define BOOST_GCC_WORKAROUND_GUARD 0
108 #define BOOST_GCC_VERSION_WORKAROUND_GUARD 0
110 #ifndef BOOST_XLCPP_ZOS
111 #define BOOST_XLCPP_ZOS_WORKAROUND_GUARD 1
113 #define BOOST_XLCPP_ZOS_WORKAROUND_GUARD 0
116 #define __IBMCPP___WORKAROUND_GUARD 1
118 #define __IBMCPP___WORKAROUND_GUARD 0
121 #define __SUNPRO_CC_WORKAROUND_GUARD 1
123 #define __SUNPRO_CC_WORKAROUND_GUARD 0
126 #define __DECCXX_VER_WORKAROUND_GUARD 1
128 #define __DECCXX_VER_WORKAROUND_GUARD 0
131 #define __MWERKS___WORKAROUND_GUARD 1
133 #define __MWERKS___WORKAROUND_GUARD 0
136 #define __EDG___WORKAROUND_GUARD 1
138 #define __EDG___WORKAROUND_GUARD 0
140 #ifndef __EDG_VERSION__
141 #define __EDG_VERSION___WORKAROUND_GUARD 1
143 #define __EDG_VERSION___WORKAROUND_GUARD 0
146 #define __HP_aCC_WORKAROUND_GUARD 1
148 #define __HP_aCC_WORKAROUND_GUARD 0
151 #define __hpxstd98_WORKAROUND_GUARD 1
153 #define __hpxstd98_WORKAROUND_GUARD 0
156 #define _CRAYC_WORKAROUND_GUARD 1
158 #define _CRAYC_WORKAROUND_GUARD 0
161 #define __DMC___WORKAROUND_GUARD 1
163 #define __DMC___WORKAROUND_GUARD 0
166 #define MPW_CPLUS_WORKAROUND_GUARD 1
168 #define MPW_CPLUS_WORKAROUND_GUARD 0
171 #define __COMO___WORKAROUND_GUARD 1
173 #define __COMO___WORKAROUND_GUARD 0
175 #ifndef __COMO_VERSION__
176 #define __COMO_VERSION___WORKAROUND_GUARD 1
178 #define __COMO_VERSION___WORKAROUND_GUARD 0
180 #ifndef __INTEL_COMPILER
181 #define __INTEL_COMPILER_WORKAROUND_GUARD 1
183 #define __INTEL_COMPILER_WORKAROUND_GUARD 0
186 #define __ICL_WORKAROUND_GUARD 1
188 #define __ICL_WORKAROUND_GUARD 0
190 #ifndef _COMPILER_VERSION
191 #define _COMPILER_VERSION_WORKAROUND_GUARD 1
193 #define _COMPILER_VERSION_WORKAROUND_GUARD 0
195 #ifndef __clang_major__
196 #define __clang_major___WORKAROUND_GUARD 1
198 #define __clang_major___WORKAROUND_GUARD 0
202 #define _RWSTD_VER_WORKAROUND_GUARD 1
204 #define _RWSTD_VER_WORKAROUND_GUARD 0
206 #ifndef BOOST_RWSTD_VER
207 #define BOOST_RWSTD_VER_WORKAROUND_GUARD 1
209 #define BOOST_RWSTD_VER_WORKAROUND_GUARD 0
212 #define __GLIBCPP___WORKAROUND_GUARD 1
214 #define __GLIBCPP___WORKAROUND_GUARD 0
216 #ifndef _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
217 #define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC_WORKAROUND_GUARD 1
219 #define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC_WORKAROUND_GUARD 0
221 #ifndef __SGI_STL_PORT
222 #define __SGI_STL_PORT_WORKAROUND_GUARD 1
224 #define __SGI_STL_PORT_WORKAROUND_GUARD 0
226 #ifndef _STLPORT_VERSION
227 #define _STLPORT_VERSION_WORKAROUND_GUARD 1
229 #define _STLPORT_VERSION_WORKAROUND_GUARD 0
231 #ifndef __LIBCOMO_VERSION__
232 #define __LIBCOMO_VERSION___WORKAROUND_GUARD 1
234 #define __LIBCOMO_VERSION___WORKAROUND_GUARD 0
237 #define _CPPLIB_VER_WORKAROUND_GUARD 1
239 #define _CPPLIB_VER_WORKAROUND_GUARD 0
242 #ifndef BOOST_INTEL_CXX_VERSION
243 #define BOOST_INTEL_CXX_VERSION_WORKAROUND_GUARD 1
245 #define BOOST_INTEL_CXX_VERSION_WORKAROUND_GUARD 0
247 #ifndef BOOST_INTEL_WIN
248 #define BOOST_INTEL_WIN_WORKAROUND_GUARD 1
250 #define BOOST_INTEL_WIN_WORKAROUND_GUARD 0
252 #ifndef BOOST_DINKUMWARE_STDLIB
253 #define BOOST_DINKUMWARE_STDLIB_WORKAROUND_GUARD 1
255 #define BOOST_DINKUMWARE_STDLIB_WORKAROUND_GUARD 0
258 #define BOOST_INTEL_WORKAROUND_GUARD 1
260 #define BOOST_INTEL_WORKAROUND_GUARD 0
262 #ifndef BOOST_CLANG_VERSION
263 #define BOOST_CLANG_VERSION_WORKAROUND_GUARD 1
265 #define BOOST_CLANG_VERSION_WORKAROUND_GUARD 0
268 // Always define to zero, if it's used it'll be defined my MPL:
269 #define BOOST_MPL_CFG_GCC_WORKAROUND_GUARD 0
271 #define BOOST_WORKAROUND(symbol, test) \
272 ((symbol ## _WORKAROUND_GUARD + 0 == 0) && \
273 (symbol != 0) && (1 % (( (symbol test) ) + 1)))
275 // The extra level of parenthesis nesting above, along with the
276 // BOOST_OPEN_PAREN indirection below, is required to satisfy the
277 // broken preprocessor in MWCW 8.3 and earlier.
279 // The basic mechanism works as follows:
280 // (symbol test) + 1 => if (symbol test) then 2 else 1
281 // 1 % ((symbol test) + 1) => if (symbol test) then 1 else 0
283 // The complication with % is for cooperation with BOOST_TESTED_AT().
284 // When "test" is BOOST_TESTED_AT(x) and
285 // BOOST_DETECT_OUTDATED_WORKAROUNDS is #defined,
287 // symbol test => if (symbol <= x) then 1 else -1
288 // (symbol test) + 1 => if (symbol <= x) then 2 else 0
289 // 1 % ((symbol test) + 1) => if (symbol <= x) then 1 else divide-by-zero
292 #ifdef BOOST_DETECT_OUTDATED_WORKAROUNDS
293 # define BOOST_OPEN_PAREN (
294 # define BOOST_TESTED_AT(value) > value) ?(-1): BOOST_OPEN_PAREN 1
296 # define BOOST_TESTED_AT(value) != ((value)-(value))
301 #define BOOST_WORKAROUND(symbol, test) 0
305 #endif // BOOST_CONFIG_WORKAROUND_HPP