2 // (C) Copyright Edward Diener 2011-2015
3 // Use, modification and distribution are subject to the Boost Software License,
4 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt).
7 #if !defined(BOOST_VMD_DETAIL_ASSERT_HPP)
8 #define BOOST_VMD_DETAIL_ASSERT_HPP
10 #include <boost/preprocessor/debug/assert.hpp>
11 #include <boost/preprocessor/variadic/elem.hpp>
15 #include <boost/preprocessor/comparison/equal.hpp>
16 #include <boost/preprocessor/control/if.hpp>
17 #include <boost/preprocessor/control/iif.hpp>
18 #include <boost/preprocessor/variadic/size.hpp>
19 #include <boost/vmd/empty.hpp>
21 #define BOOST_VMD_DETAIL_ASSERT_VC_GEN_ERROR_OUTPUT(errstr) \
23 typedef char errstr[-1]; \
26 #define BOOST_VMD_DETAIL_ASSERT_VC_GEN_ERROR_DEFAULT(...) \
27 BOOST_VMD_DETAIL_ASSERT_VC_GEN_ERROR_OUTPUT(BOOST_VMD_ASSERT_ERROR) \
30 #define BOOST_VMD_DETAIL_ASSERT_VC_GEN_ERROR_ERRSTR(...) \
31 BOOST_VMD_DETAIL_ASSERT_VC_GEN_ERROR_OUTPUT(BOOST_PP_VARIADIC_ELEM(1,__VA_ARGS__)) \
34 #define BOOST_VMD_DETAIL_ASSERT_TRUE(...) \
39 BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), \
42 BOOST_VMD_DETAIL_ASSERT_VC_GEN_ERROR_DEFAULT, \
43 BOOST_VMD_DETAIL_ASSERT_VC_GEN_ERROR_ERRSTR \
48 #define BOOST_VMD_DETAIL_ASSERT(...) \
51 BOOST_PP_VARIADIC_ELEM(0,__VA_ARGS__), \
53 BOOST_VMD_DETAIL_ASSERT_TRUE \
60 #define BOOST_VMD_DETAIL_ASSERT_DO(cond) \
61 BOOST_PP_ASSERT(cond) \
64 #define BOOST_VMD_DETAIL_ASSERT(...) \
65 BOOST_VMD_DETAIL_ASSERT_DO(BOOST_PP_VARIADIC_ELEM(0,__VA_ARGS__)) \
68 #endif /* BOOST_VMD_MSVC */
69 #endif /* BOOST_VMD_DETAIL_ASSERT_HPP */