1
// Copyright David Abrahams 2002. Permission to copy, use,
2
// modify, sell and distribute this software is granted provided this
3
// copyright notice appears in all copies. This software is provided
4
// "as is" without express or implied warranty, and with no claim as
5
// to its suitability for any purpose.
6
#ifndef WORKAROUND_DWA2002126_HPP
7
# define WORKAROUND_DWA2002126_HPP
9
// Compiler/library version workaround macro
13
// #if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
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) <= 1200
23
// When used for workarounds on the latest known version of a
24
// compiler, the following convention should be observed:
26
// #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1301))
28
// The version number in this case corresponds to the last version in
29
// which the workaround was known to have been required. It only has
30
// value as a comment unless BOOST_DETECT_OUTDATED_WORKAROUNDS is
31
// defined, in which case a compiler warning or error will be issued
32
// when the compiler version exceeds the argument to BOOST_TESTED_AT
34
# ifndef BOOST_STRICT_CONFIG
36
# define BOOST_WORKAROUND(symbol, test) \
37
((symbol != 0) && (1 % (( (symbol test) ) + 1)))
39
// The extra level of parenthesis nesting above, along with the
40
// BOOST_OPEN_PAREN indirection below, is required to satisfy the
41
// broken preprocessor in MWCW 8.3 and earlier.
43
// The basic mechanism works as follows:
44
// (symbol test) + 1 => 2 if the test passes, 1 otherwise
45
// 1 % ((symbol test) + 1) => 1 if the test passes, 0 otherwise
47
// The complication with % is for cooperation with BOOST_TESTED_AT().
48
// When "test" is BOOST_TESTED_AT(x) and
49
// BOOST_DETECT_OUTDATED_WORKAROUNDS is #defined,
51
// symbol test => 1 if symbol <= x, -1 otherwise
52
// (symbol test) + 1 => 2 if symbol <= x, 0 otherwise
53
// 1 % ((symbol test) + 1) => 1 if symbol <= x, zero divide otherwise
56
# ifdef BOOST_DETECT_OUTDATED_WORKAROUNDS
57
# define BOOST_OPEN_PAREN (
58
# define BOOST_TESTED_AT(value) > value) ?(-1): BOOST_OPEN_PAREN 1
60
# define BOOST_TESTED_AT(value) != 0
65
# define BOOST_WORKAROUND(symbol, test) 0
69
#endif // WORKAROUND_DWA2002126_HPP