1 /* Used in Boost.MultiIndex tests.
3 * Copyright 2003-2008 Joaquin M Lopez Munoz.
4 * Distributed under the Boost Software License, Version 1.0.
5 * (See accompanying file LICENSE_1_0.txt or copy at
6 * http://www.boost.org/LICENSE_1_0.txt)
8 * See http://www.boost.org/libs/multi_index for library home page.
11 #ifndef BOOST_MULTI_INDEX_TEST_PRE_MULTI_INDEX_HPP
12 #define BOOST_MULTI_INDEX_TEST_PRE_MULTI_INDEX_HPP
14 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
15 #include <boost/detail/workaround.hpp>
16 #include <boost/multi_index/safe_mode_errors.hpp>
18 #if defined(__GNUC__)&&defined(__APPLE__)&&\
19 (__GNUC__==4)&&(__GNUC_MINOR__==0)&&(__APPLE_CC__<=4061)
20 /* Darwin 8.1 includes a prerelease version of GCC 4.0 that, alas,
21 * has a regression as described in
22 * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17435
23 * This compiler bug (fixed in the official 4.0 release) ruins the
24 * mechanisms upon which invariant-checking scope guards are built,
25 * so we can't set the invariant checking mode.
28 #define BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING
31 #define BOOST_MULTI_INDEX_ENABLE_SAFE_MODE
33 #if BOOST_WORKAROUND(__IBMCPP__,<=600)
34 #pragma info(nolan) /* suppress warnings about offsetof with non-POD types */
37 struct safe_mode_exception
39 safe_mode_exception(boost::multi_index::safe_mode::error_code error_code_):
40 error_code(error_code_)
43 boost::multi_index::safe_mode::error_code error_code;
46 #define BOOST_MULTI_INDEX_SAFE_MODE_ASSERT(expr,error_code) \
47 if(!(expr)){throw safe_mode_exception(error_code);}