pre_multi_index.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. #ifndef BOOST_MULTI_INDEX_TEST_PRE_MULTI_INDEX_HPP
  11. #define BOOST_MULTI_INDEX_TEST_PRE_MULTI_INDEX_HPP
  12. #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
  13. #include <boost/detail/workaround.hpp>
  14. #include <boost/multi_index/safe_mode_errors.hpp>
  15. #if defined(__GNUC__)&&defined(__APPLE__)&&\
  16. (__GNUC__==4)&&(__GNUC_MINOR__==0)&&(__APPLE_CC__<=4061)
  17. /* Darwin 8.1 includes a prerelease version of GCC 4.0 that, alas,
  18. * has a regression as described in
  19. * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17435
  20. * This compiler bug (fixed in the official 4.0 release) ruins the
  21. * mechanisms upon which invariant-checking scope guards are built,
  22. * so we can't set the invariant checking mode.
  23. */
  24. #else
  25. #define BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING
  26. #endif
  27. #define BOOST_MULTI_INDEX_ENABLE_SAFE_MODE
  28. #if BOOST_WORKAROUND(__IBMCPP__,<=600)
  29. #pragma info(nolan) /* suppress warnings about offsetof with non-POD types */
  30. #endif
  31. struct safe_mode_exception
  32. {
  33. safe_mode_exception(boost::multi_index::safe_mode::error_code error_code_):
  34. error_code(error_code_)
  35. {}
  36. boost::multi_index::safe_mode::error_code error_code;
  37. };
  38. #define BOOST_MULTI_INDEX_SAFE_MODE_ASSERT(expr,error_code) \
  39. if(!(expr)){throw safe_mode_exception(error_code);}
  40. #endif