|
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 |
1 |
7 |
2 #ifndef BOOST_MPL_AUX_CONFIG_WORKAROUND_HPP_INCLUDED |
8 // Compiler/library version workaround macro |
3 #define BOOST_MPL_AUX_CONFIG_WORKAROUND_HPP_INCLUDED |
9 // |
|
10 // Usage: |
|
11 // |
|
12 // #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) |
|
13 // // workaround for eVC4 and VC6 |
|
14 // ... // workaround code here |
|
15 // #endif |
|
16 // |
|
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: |
|
20 // |
|
21 // (BOOST_MSVC) != 0 && (BOOST_MSVC) < 1300 |
|
22 // |
|
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: |
|
26 // |
|
27 // #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1301)) |
|
28 // |
|
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. |
4 |
38 |
5 // Copyright Aleksey Gurtovoy 2002-2004 |
39 # ifndef BOOST_STRICT_CONFIG |
|
40 |
|
41 # define BOOST_WORKAROUND(symbol, test) \ |
|
42 ((symbol != 0) && (1 % (( (symbol test) ) + 1))) |
|
43 // ^ ^ ^ ^ |
|
44 // The extra level of parenthesis nesting above, along with the |
|
45 // BOOST_OPEN_PAREN indirection below, is required to satisfy the |
|
46 // broken preprocessor in MWCW 8.3 and earlier. |
6 // |
47 // |
7 // Distributed under the Boost Software License, Version 1.0. |
48 // The basic mechanism works as follows: |
8 // (See accompanying file LICENSE_1_0.txt or copy at |
49 // (symbol test) + 1 => if (symbol test) then 2 else 1 |
9 // http://www.boost.org/LICENSE_1_0.txt) |
50 // 1 % ((symbol test) + 1) => if (symbol test) then 1 else 0 |
10 // |
51 // |
11 // See http://www.boost.org/libs/mpl for documentation. |
52 // The complication with % is for cooperation with BOOST_TESTED_AT(). |
|
53 // When "test" is BOOST_TESTED_AT(x) and |
|
54 // BOOST_DETECT_OUTDATED_WORKAROUNDS is #defined, |
|
55 // |
|
56 // symbol test => if (symbol <= x) then 1 else -1 |
|
57 // (symbol test) + 1 => if (symbol <= x) then 2 else 0 |
|
58 // 1 % ((symbol test) + 1) => if (symbol <= x) then 1 else divide-by-zero |
|
59 // |
12 |
60 |
13 // $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/workaround.hpp,v $ |
61 # ifdef BOOST_DETECT_OUTDATED_WORKAROUNDS |
14 // $Date: 2004/09/02 15:40:45 $ |
62 # define BOOST_OPEN_PAREN ( |
15 // $Revision: 1.3 $ |
63 # define BOOST_TESTED_AT(value) > value) ?(-1): BOOST_OPEN_PAREN 1 |
|
64 # else |
|
65 # define BOOST_TESTED_AT(value) != ((value)-(value)) |
|
66 # endif |
16 |
67 |
17 #include <boost/detail/workaround.hpp> |
68 # else |
18 |
69 |
19 #endif // BOOST_MPL_AUX_CONFIG_WORKAROUND_HPP_INCLUDED |
70 # define BOOST_WORKAROUND(symbol, test) 0 |
|
71 |
|
72 # endif |
|
73 |
|
74 #endif // WORKAROUND_DWA2002126_HPP |