File indexing completed on 2025-01-18 09:53:36
0001
0002
0003
0004
0005
0006
0007 #if !defined(BOOST_VMD_DETAIL_ASSERT_HPP)
0008 #define BOOST_VMD_DETAIL_ASSERT_HPP
0009
0010 #include <boost/preprocessor/debug/assert.hpp>
0011 #include <boost/preprocessor/variadic/elem.hpp>
0012
0013 #if BOOST_VMD_MSVC
0014
0015 #include <boost/preprocessor/comparison/equal.hpp>
0016 #include <boost/preprocessor/control/if.hpp>
0017 #include <boost/preprocessor/control/iif.hpp>
0018 #include <boost/preprocessor/variadic/size.hpp>
0019 #include <boost/vmd/empty.hpp>
0020
0021 #define BOOST_VMD_DETAIL_ASSERT_VC_GEN_ERROR_OUTPUT(errstr) \
0022 BOOST_PP_ASSERT(0) \
0023 typedef char errstr[-1]; \
0024
0025
0026 #define BOOST_VMD_DETAIL_ASSERT_VC_GEN_ERROR_DEFAULT(...) \
0027 BOOST_VMD_DETAIL_ASSERT_VC_GEN_ERROR_OUTPUT(BOOST_VMD_ASSERT_ERROR) \
0028
0029
0030 #define BOOST_VMD_DETAIL_ASSERT_VC_GEN_ERROR_ERRSTR(...) \
0031 BOOST_VMD_DETAIL_ASSERT_VC_GEN_ERROR_OUTPUT(BOOST_PP_VARIADIC_ELEM(1,__VA_ARGS__)) \
0032
0033
0034 #define BOOST_VMD_DETAIL_ASSERT_TRUE(...) \
0035 BOOST_PP_IIF \
0036 ( \
0037 BOOST_PP_EQUAL \
0038 ( \
0039 BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), \
0040 1 \
0041 ), \
0042 BOOST_VMD_DETAIL_ASSERT_VC_GEN_ERROR_DEFAULT, \
0043 BOOST_VMD_DETAIL_ASSERT_VC_GEN_ERROR_ERRSTR \
0044 ) \
0045 (__VA_ARGS__) \
0046
0047
0048 #define BOOST_VMD_DETAIL_ASSERT(...) \
0049 BOOST_PP_IF \
0050 ( \
0051 BOOST_PP_VARIADIC_ELEM(0,__VA_ARGS__), \
0052 BOOST_VMD_EMPTY, \
0053 BOOST_VMD_DETAIL_ASSERT_TRUE \
0054 ) \
0055 (__VA_ARGS__) \
0056
0057
0058 #else
0059
0060 #define BOOST_VMD_DETAIL_ASSERT_DO(cond) \
0061 BOOST_PP_ASSERT(cond) \
0062
0063
0064 #define BOOST_VMD_DETAIL_ASSERT(...) \
0065 BOOST_VMD_DETAIL_ASSERT_DO(BOOST_PP_VARIADIC_ELEM(0,__VA_ARGS__)) \
0066
0067
0068 #endif
0069 #endif