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 WORKAROUND_DWA2002126_HPP
6 # define WORKAROUND_DWA2002126_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
54 #define _MSC_VER_WORKAROUND_GUARD 1
56 #define _MSC_VER_WORKAROUND_GUARD 0
59 #define _MSC_FULL_VER_WORKAROUND_GUARD 1
61 #define _MSC_FULL_VER_WORKAROUND_GUARD 0
64 #define BOOST_MSVC_WORKAROUND_GUARD 1
66 #define BOOST_MSVC_WORKAROUND_GUARD 0
69 #define __GNUC___WORKAROUND_GUARD 1
71 #define __GNUC___WORKAROUND_GUARD 0
73 #ifndef __GNUC_MINOR__
74 #define __GNUC_MINOR___WORKAROUND_GUARD 1
76 #define __GNUC_MINOR___WORKAROUND_GUARD 0
78 #ifndef __GNUC_PATCHLEVEL__
79 #define __GNUC_PATCHLEVEL___WORKAROUND_GUARD 1
81 #define __GNUC_PATCHLEVEL___WORKAROUND_GUARD 0
84 #define __IBMCPP___WORKAROUND_GUARD 1
86 #define __IBMCPP___WORKAROUND_GUARD 0
89 #define __SUNPRO_CC_WORKAROUND_GUARD 1
91 #define __SUNPRO_CC_WORKAROUND_GUARD 0
94 #define __DECCXX_VER_WORKAROUND_GUARD 1
96 #define __DECCXX_VER_WORKAROUND_GUARD 0
99 #define __MWERKS___WORKAROUND_GUARD 1
101 #define __MWERKS___WORKAROUND_GUARD 0
104 #define __EDG___WORKAROUND_GUARD 1
106 #define __EDG___WORKAROUND_GUARD 0
108 #ifndef __EDG_VERSION__
109 #define __EDG_VERSION___WORKAROUND_GUARD 1
111 #define __EDG_VERSION___WORKAROUND_GUARD 0
114 #define __HP_aCC_WORKAROUND_GUARD 1
116 #define __HP_aCC_WORKAROUND_GUARD 0
119 #define __hpxstd98_WORKAROUND_GUARD 1
121 #define __hpxstd98_WORKAROUND_GUARD 0
124 #define _CRAYC_WORKAROUND_GUARD 1
126 #define _CRAYC_WORKAROUND_GUARD 0
129 #define __DMC___WORKAROUND_GUARD 1
131 #define __DMC___WORKAROUND_GUARD 0
134 #define MPW_CPLUS_WORKAROUND_GUARD 1
136 #define MPW_CPLUS_WORKAROUND_GUARD 0
139 #define __COMO___WORKAROUND_GUARD 1
141 #define __COMO___WORKAROUND_GUARD 0
143 #ifndef __COMO_VERSION__
144 #define __COMO_VERSION___WORKAROUND_GUARD 1
146 #define __COMO_VERSION___WORKAROUND_GUARD 0
148 #ifndef __INTEL_COMPILER
149 #define __INTEL_COMPILER_WORKAROUND_GUARD 1
151 #define __INTEL_COMPILER_WORKAROUND_GUARD 0
154 #define __ICL_WORKAROUND_GUARD 1
156 #define __ICL_WORKAROUND_GUARD 0
158 #ifndef _COMPILER_VERSION
159 #define _COMPILER_VERSION_WORKAROUND_GUARD 1
161 #define _COMPILER_VERSION_WORKAROUND_GUARD 0
165 #define _RWSTD_VER_WORKAROUND_GUARD 1
167 #define _RWSTD_VER_WORKAROUND_GUARD 0
169 #ifndef BOOST_RWSTD_VER
170 #define BOOST_RWSTD_VER_WORKAROUND_GUARD 1
172 #define BOOST_RWSTD_VER_WORKAROUND_GUARD 0
175 #define __GLIBCPP___WORKAROUND_GUARD 1
177 #define __GLIBCPP___WORKAROUND_GUARD 0
179 #ifndef _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
180 #define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC_WORKAROUND_GUARD 1
182 #define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC_WORKAROUND_GUARD 0
184 #ifndef __SGI_STL_PORT
185 #define __SGI_STL_PORT_WORKAROUND_GUARD 1
187 #define __SGI_STL_PORT_WORKAROUND_GUARD 0
189 #ifndef _STLPORT_VERSION
190 #define _STLPORT_VERSION_WORKAROUND_GUARD 1
192 #define _STLPORT_VERSION_WORKAROUND_GUARD 0
194 #ifndef __LIBCOMO_VERSION__
195 #define __LIBCOMO_VERSION___WORKAROUND_GUARD 1
197 #define __LIBCOMO_VERSION___WORKAROUND_GUARD 0
200 #define _CPPLIB_VER_WORKAROUND_GUARD 1
202 #define _CPPLIB_VER_WORKAROUND_GUARD 0
205 #ifndef BOOST_INTEL_CXX_VERSION
206 #define BOOST_INTEL_CXX_VERSION_WORKAROUND_GUARD 1
208 #define BOOST_INTEL_CXX_VERSION_WORKAROUND_GUARD 0
210 #ifndef BOOST_INTEL_WIN
211 #define BOOST_INTEL_WIN_WORKAROUND_GUARD 1
213 #define BOOST_INTEL_WIN_WORKAROUND_GUARD 0
215 #ifndef BOOST_DINKUMWARE_STDLIB
216 #define BOOST_DINKUMWARE_STDLIB_WORKAROUND_GUARD 1
218 #define BOOST_DINKUMWARE_STDLIB_WORKAROUND_GUARD 0
221 #define BOOST_INTEL_WORKAROUND_GUARD 1
223 #define BOOST_INTEL_WORKAROUND_GUARD 0
225 // Always define to zero, if it's used it'll be defined my MPL:
226 #define BOOST_MPL_CFG_GCC_WORKAROUND_GUARD 0
228 # define BOOST_WORKAROUND(symbol, test) \
229 ((symbol ## _WORKAROUND_GUARD + 0 == 0) && \
230 (symbol != 0) && (1 % (( (symbol test) ) + 1)))
232 // The extra level of parenthesis nesting above, along with the
233 // BOOST_OPEN_PAREN indirection below, is required to satisfy the
234 // broken preprocessor in MWCW 8.3 and earlier.
236 // The basic mechanism works as follows:
237 // (symbol test) + 1 => if (symbol test) then 2 else 1
238 // 1 % ((symbol test) + 1) => if (symbol test) then 1 else 0
240 // The complication with % is for cooperation with BOOST_TESTED_AT().
241 // When "test" is BOOST_TESTED_AT(x) and
242 // BOOST_DETECT_OUTDATED_WORKAROUNDS is #defined,
244 // symbol test => if (symbol <= x) then 1 else -1
245 // (symbol test) + 1 => if (symbol <= x) then 2 else 0
246 // 1 % ((symbol test) + 1) => if (symbol <= x) then 1 else divide-by-zero
249 # ifdef BOOST_DETECT_OUTDATED_WORKAROUNDS
250 # define BOOST_OPEN_PAREN (
251 # define BOOST_TESTED_AT(value) > value) ?(-1): BOOST_OPEN_PAREN 1
253 # define BOOST_TESTED_AT(value) != ((value)-(value))
258 # define BOOST_WORKAROUND(symbol, test) 0
262 #endif // WORKAROUND_DWA2002126_HPP