Back to home page

EIC code displayed by LXR

 
 

    


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 // Copyright (C) 2008-2018 Lorenzo Caminiti
0006 // Distributed under the Boost Software License, Version 1.0 (see accompanying
0007 // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
0008 // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html
0009 
0010 #include <boost/contract/core/config.hpp> 
0011 #ifndef BOOST_CONTRACT_NO_CHECKS
0012     #include <boost/contract/core/exception.hpp>
0013 
0014     /* PRIVATE */
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             /* this name somewhat unique to min var shadow warnings */ \
0024             boost::contract::detail::checking BOOST_CONTRACT_DETAIL_NAME2( \
0025                     guard, __LINE__);
0026     #else
0027         #define BOOST_CONTRACT_CHECK_IF_NOT_CHECKING_ALREADY_ /* nothing */
0028         #define BOOST_CONTRACT_CHECK_CHECKING_VAR_(guard) /* nothing */
0029     #endif
0030     
0031     /* PUBLIC */
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 // #include guard
0048