File indexing completed on 2025-01-18 09:30:26
0001
0002 #ifndef BOOST_CONTRACT_DETAIL_CHECK_HPP_
0003 #define BOOST_CONTRACT_DETAIL_CHECK_HPP_
0004
0005
0006
0007
0008
0009
0010 #include <boost/contract/core/config.hpp>
0011 #ifndef BOOST_CONTRACT_NO_CHECKS
0012 #include <boost/contract/core/exception.hpp>
0013
0014
0015
0016 #ifndef BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
0017 #include <boost/contract/detail/checking.hpp>
0018 #include <boost/contract/detail/name.hpp>
0019
0020 #define BOOST_CONTRACT_CHECK_IF_NOT_CHECKING_ALREADY_ \
0021 if(!boost::contract::detail::checking::already())
0022 #define BOOST_CONTRACT_CHECK_CHECKING_VAR_(guard) \
0023 \
0024 boost::contract::detail::checking BOOST_CONTRACT_DETAIL_NAME2( \
0025 guard, __LINE__);
0026 #else
0027 #define BOOST_CONTRACT_CHECK_IF_NOT_CHECKING_ALREADY_
0028 #define BOOST_CONTRACT_CHECK_CHECKING_VAR_(guard)
0029 #endif
0030
0031
0032
0033 #define BOOST_CONTRACT_DETAIL_CHECK(assertion) \
0034 { \
0035 try { \
0036 BOOST_CONTRACT_CHECK_IF_NOT_CHECKING_ALREADY_ \
0037 { \
0038 BOOST_CONTRACT_CHECK_CHECKING_VAR_(k) \
0039 { assertion; } \
0040 } \
0041 } catch(...) { boost::contract::check_failure(); } \
0042 }
0043 #else
0044 #define BOOST_CONTRACT_DETAIL_CHECK(assertion) {}
0045 #endif
0046
0047 #endif
0048