~ubuntu-branches/ubuntu/saucy/rrootage/saucy

« back to all changes in this revision

Viewing changes to src/bulletml/boost/detail/workaround.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Miriam Ruiz
  • Date: 2005-04-07 02:21:00 UTC
  • Revision ID: james.westby@ubuntu.com-20050407022100-uokbm0q4wxf9iad3
Tags: upstream-0.23a
ImportĀ upstreamĀ versionĀ 0.23a

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
8
 
 
9
// Compiler/library version workaround macro
 
10
//
 
11
// Usage:
 
12
//
 
13
//     #if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
 
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) <= 1200
 
22
//
 
23
// When used for workarounds on the latest known version of a
 
24
// compiler, the following convention should be observed:
 
25
//
 
26
//     #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1301))
 
27
//
 
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
 
33
 
 
34
# ifndef BOOST_STRICT_CONFIG
 
35
 
 
36
#  define BOOST_WORKAROUND(symbol, test)                \
 
37
        ((symbol != 0) && (1 % (( (symbol test) ) + 1)))
 
38
//                              ^ ^           ^ ^
 
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.
 
42
//
 
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
 
46
//
 
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,
 
50
//
 
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
 
54
//
 
55
 
 
56
#  ifdef BOOST_DETECT_OUTDATED_WORKAROUNDS
 
57
#   define BOOST_OPEN_PAREN (
 
58
#   define BOOST_TESTED_AT(value)  > value) ?(-1): BOOST_OPEN_PAREN 1
 
59
#  else
 
60
#   define BOOST_TESTED_AT(value) != 0
 
61
#  endif
 
62
 
 
63
# else
 
64
 
 
65
#  define BOOST_WORKAROUND(symbol, test) 0
 
66
 
 
67
# endif 
 
68
 
 
69
#endif // WORKAROUND_DWA2002126_HPP