1 /* Used in Boost.MultiIndex tests. 2 * 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) 7 * 8 * See http://www.boost.org/libs/multi_index for library home page. 9 */ 10 11 #ifndef BOOST_MULTI_INDEX_TEST_PRE_MULTI_INDEX_HPP 12 #define BOOST_MULTI_INDEX_TEST_PRE_MULTI_INDEX_HPP 13 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> 17 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. 26 */ 27 #else 28 #define BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING 29 #endif 30 31 #define BOOST_MULTI_INDEX_ENABLE_SAFE_MODE 32 33 #if BOOST_WORKAROUND(__IBMCPP__,<=600) 34 #pragma info(nolan) /* suppress warnings about offsetof with non-POD types */ 35 #endif 36 37 struct safe_mode_exception 38 { safe_mode_exceptionsafe_mode_exception39 safe_mode_exception(boost::multi_index::safe_mode::error_code error_code_): 40 error_code(error_code_) 41 {} 42 43 boost::multi_index::safe_mode::error_code error_code; 44 }; 45 46 #define BOOST_MULTI_INDEX_SAFE_MODE_ASSERT(expr,error_code) \ 47 if(!(expr)){throw safe_mode_exception(error_code);} 48 49 #endif 50