1 // Copyright David Abrahams 2002.
\r
2 // Distributed under the Boost Software License, Version 1.0. (See
\r
3 // accompanying file LICENSE_1_0.txt or copy at
\r
4 // http://www.boost.org/LICENSE_1_0.txt)
\r
5 #ifndef WORKAROUND_DWA2002126_HPP
\r
6 # define WORKAROUND_DWA2002126_HPP
\r
8 // Compiler/library version workaround macro
\r
12 // #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
\r
13 // // workaround for eVC4 and VC6
\r
14 // ... // workaround code here
\r
17 // When BOOST_STRICT_CONFIG is defined, expands to 0. Otherwise, the
\r
18 // first argument must be undefined or expand to a numeric
\r
19 // value. The above expands to:
\r
21 // (BOOST_MSVC) != 0 && (BOOST_MSVC) < 1300
\r
23 // When used for workarounds that apply to the latest known version
\r
24 // and all earlier versions of a compiler, the following convention
\r
25 // should be observed:
\r
27 // #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1301))
\r
29 // The version number in this case corresponds to the last version in
\r
30 // which the workaround was known to have been required. When
\r
31 // BOOST_DETECT_OUTDATED_WORKAROUNDS is not the defined, the macro
\r
32 // BOOST_TESTED_AT(x) expands to "!= 0", which effectively activates
\r
33 // the workaround for any version of the compiler. When
\r
34 // BOOST_DETECT_OUTDATED_WORKAROUNDS is defined, a compiler warning or
\r
35 // error will be issued if the compiler version exceeds the argument
\r
36 // to BOOST_TESTED_AT(). This can be used to locate workarounds which
\r
37 // may be obsoleted by newer versions.
\r
39 # ifndef BOOST_STRICT_CONFIG
\r
41 #include <boost/config.hpp>
\r
43 #ifndef __BORLANDC__
\r
44 #define __BORLANDC___WORKAROUND_GUARD 1
\r
46 #define __BORLANDC___WORKAROUND_GUARD 0
\r
48 #ifndef __CODEGEARC__
\r
49 #define __CODEGEARC___WORKAROUND_GUARD 1
\r
51 #define __CODEGEARC___WORKAROUND_GUARD 0
\r
54 #define _MSC_VER_WORKAROUND_GUARD 1
\r
56 #define _MSC_VER_WORKAROUND_GUARD 0
\r
58 #ifndef _MSC_FULL_VER
\r
59 #define _MSC_FULL_VER_WORKAROUND_GUARD 1
\r
61 #define _MSC_FULL_VER_WORKAROUND_GUARD 0
\r
64 #define BOOST_MSVC_WORKAROUND_GUARD 1
\r
66 #define BOOST_MSVC_WORKAROUND_GUARD 0
\r
69 #define __GNUC___WORKAROUND_GUARD 1
\r
71 #define __GNUC___WORKAROUND_GUARD 0
\r
73 #ifndef __GNUC_MINOR__
\r
74 #define __GNUC_MINOR___WORKAROUND_GUARD 1
\r
76 #define __GNUC_MINOR___WORKAROUND_GUARD 0
\r
78 #ifndef __GNUC_PATCHLEVEL__
\r
79 #define __GNUC_PATCHLEVEL___WORKAROUND_GUARD 1
\r
81 #define __GNUC_PATCHLEVEL___WORKAROUND_GUARD 0
\r
84 #define __IBMCPP___WORKAROUND_GUARD 1
\r
86 #define __IBMCPP___WORKAROUND_GUARD 0
\r
89 #define __SUNPRO_CC_WORKAROUND_GUARD 1
\r
91 #define __SUNPRO_CC_WORKAROUND_GUARD 0
\r
93 #ifndef __DECCXX_VER
\r
94 #define __DECCXX_VER_WORKAROUND_GUARD 1
\r
96 #define __DECCXX_VER_WORKAROUND_GUARD 0
\r
99 #define __MWERKS___WORKAROUND_GUARD 1
\r
101 #define __MWERKS___WORKAROUND_GUARD 0
\r
104 #define __EDG___WORKAROUND_GUARD 1
\r
106 #define __EDG___WORKAROUND_GUARD 0
\r
108 #ifndef __EDG_VERSION__
\r
109 #define __EDG_VERSION___WORKAROUND_GUARD 1
\r
111 #define __EDG_VERSION___WORKAROUND_GUARD 0
\r
114 #define __HP_aCC_WORKAROUND_GUARD 1
\r
116 #define __HP_aCC_WORKAROUND_GUARD 0
\r
119 #define __hpxstd98_WORKAROUND_GUARD 1
\r
121 #define __hpxstd98_WORKAROUND_GUARD 0
\r
124 #define _CRAYC_WORKAROUND_GUARD 1
\r
126 #define _CRAYC_WORKAROUND_GUARD 0
\r
129 #define __DMC___WORKAROUND_GUARD 1
\r
131 #define __DMC___WORKAROUND_GUARD 0
\r
134 #define MPW_CPLUS_WORKAROUND_GUARD 1
\r
136 #define MPW_CPLUS_WORKAROUND_GUARD 0
\r
139 #define __COMO___WORKAROUND_GUARD 1
\r
141 #define __COMO___WORKAROUND_GUARD 0
\r
143 #ifndef __COMO_VERSION__
\r
144 #define __COMO_VERSION___WORKAROUND_GUARD 1
\r
146 #define __COMO_VERSION___WORKAROUND_GUARD 0
\r
148 #ifndef __INTEL_COMPILER
\r
149 #define __INTEL_COMPILER_WORKAROUND_GUARD 1
\r
151 #define __INTEL_COMPILER_WORKAROUND_GUARD 0
\r
154 #define __ICL_WORKAROUND_GUARD 1
\r
156 #define __ICL_WORKAROUND_GUARD 0
\r
158 #ifndef _COMPILER_VERSION
\r
159 #define _COMPILER_VERSION_WORKAROUND_GUARD 1
\r
161 #define _COMPILER_VERSION_WORKAROUND_GUARD 0
\r
165 #define _RWSTD_VER_WORKAROUND_GUARD 1
\r
167 #define _RWSTD_VER_WORKAROUND_GUARD 0
\r
169 #ifndef BOOST_RWSTD_VER
\r
170 #define BOOST_RWSTD_VER_WORKAROUND_GUARD 1
\r
172 #define BOOST_RWSTD_VER_WORKAROUND_GUARD 0
\r
174 #ifndef __GLIBCPP__
\r
175 #define __GLIBCPP___WORKAROUND_GUARD 1
\r
177 #define __GLIBCPP___WORKAROUND_GUARD 0
\r
179 #ifndef _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
\r
180 #define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC_WORKAROUND_GUARD 1
\r
182 #define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC_WORKAROUND_GUARD 0
\r
184 #ifndef __SGI_STL_PORT
\r
185 #define __SGI_STL_PORT_WORKAROUND_GUARD 1
\r
187 #define __SGI_STL_PORT_WORKAROUND_GUARD 0
\r
189 #ifndef _STLPORT_VERSION
\r
190 #define _STLPORT_VERSION_WORKAROUND_GUARD 1
\r
192 #define _STLPORT_VERSION_WORKAROUND_GUARD 0
\r
194 #ifndef __LIBCOMO_VERSION__
\r
195 #define __LIBCOMO_VERSION___WORKAROUND_GUARD 1
\r
197 #define __LIBCOMO_VERSION___WORKAROUND_GUARD 0
\r
199 #ifndef _CPPLIB_VER
\r
200 #define _CPPLIB_VER_WORKAROUND_GUARD 1
\r
202 #define _CPPLIB_VER_WORKAROUND_GUARD 0
\r
205 #ifndef BOOST_INTEL_CXX_VERSION
\r
206 #define BOOST_INTEL_CXX_VERSION_WORKAROUND_GUARD 1
\r
208 #define BOOST_INTEL_CXX_VERSION_WORKAROUND_GUARD 0
\r
210 #ifndef BOOST_INTEL_WIN
\r
211 #define BOOST_INTEL_WIN_WORKAROUND_GUARD 1
\r
213 #define BOOST_INTEL_WIN_WORKAROUND_GUARD 0
\r
215 #ifndef BOOST_DINKUMWARE_STDLIB
\r
216 #define BOOST_DINKUMWARE_STDLIB_WORKAROUND_GUARD 1
\r
218 #define BOOST_DINKUMWARE_STDLIB_WORKAROUND_GUARD 0
\r
220 #ifndef BOOST_INTEL
\r
221 #define BOOST_INTEL_WORKAROUND_GUARD 1
\r
223 #define BOOST_INTEL_WORKAROUND_GUARD 0
\r
225 // Always define to zero, if it's used it'll be defined my MPL:
\r
226 #define BOOST_MPL_CFG_GCC_WORKAROUND_GUARD 0
\r
228 # define BOOST_WORKAROUND(symbol, test) \
\r
229 ((symbol ## _WORKAROUND_GUARD + 0 == 0) && \
\r
230 (symbol != 0) && (1 % (( (symbol test) ) + 1)))
\r
232 // The extra level of parenthesis nesting above, along with the
\r
233 // BOOST_OPEN_PAREN indirection below, is required to satisfy the
\r
234 // broken preprocessor in MWCW 8.3 and earlier.
\r
236 // The basic mechanism works as follows:
\r
237 // (symbol test) + 1 => if (symbol test) then 2 else 1
\r
238 // 1 % ((symbol test) + 1) => if (symbol test) then 1 else 0
\r
240 // The complication with % is for cooperation with BOOST_TESTED_AT().
\r
241 // When "test" is BOOST_TESTED_AT(x) and
\r
242 // BOOST_DETECT_OUTDATED_WORKAROUNDS is #defined,
\r
244 // symbol test => if (symbol <= x) then 1 else -1
\r
245 // (symbol test) + 1 => if (symbol <= x) then 2 else 0
\r
246 // 1 % ((symbol test) + 1) => if (symbol <= x) then 1 else divide-by-zero
\r
249 # ifdef BOOST_DETECT_OUTDATED_WORKAROUNDS
\r
250 # define BOOST_OPEN_PAREN (
\r
251 # define BOOST_TESTED_AT(value) > value) ?(-1): BOOST_OPEN_PAREN 1
\r
253 # define BOOST_TESTED_AT(value) != ((value)-(value))
\r
258 # define BOOST_WORKAROUND(symbol, test) 0
\r
262 #endif // WORKAROUND_DWA2002126_HPP
\r