]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/vmd/include/boost/vmd/detail/assert.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / vmd / include / boost / vmd / detail / assert.hpp
CommitLineData
7c673cae
FG
1
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).
6
7#if !defined(BOOST_VMD_DETAIL_ASSERT_HPP)
8#define BOOST_VMD_DETAIL_ASSERT_HPP
9
10#include <boost/preprocessor/debug/assert.hpp>
11#include <boost/preprocessor/variadic/elem.hpp>
12
13#if BOOST_VMD_MSVC
14
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>
20
21#define BOOST_VMD_DETAIL_ASSERT_VC_GEN_ERROR_OUTPUT(errstr) \
22 BOOST_PP_ASSERT(0) \
23 typedef char errstr[-1]; \
24/**/
25
26#define BOOST_VMD_DETAIL_ASSERT_VC_GEN_ERROR_DEFAULT(...) \
27 BOOST_VMD_DETAIL_ASSERT_VC_GEN_ERROR_OUTPUT(BOOST_VMD_ASSERT_ERROR) \
28/**/
29
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__)) \
32/**/
33
34#define BOOST_VMD_DETAIL_ASSERT_TRUE(...) \
35 BOOST_PP_IIF \
36 ( \
37 BOOST_PP_EQUAL \
38 ( \
39 BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), \
40 1 \
41 ), \
42 BOOST_VMD_DETAIL_ASSERT_VC_GEN_ERROR_DEFAULT, \
43 BOOST_VMD_DETAIL_ASSERT_VC_GEN_ERROR_ERRSTR \
44 ) \
45 (__VA_ARGS__) \
46/**/
47
48#define BOOST_VMD_DETAIL_ASSERT(...) \
49 BOOST_PP_IF \
50 ( \
51 BOOST_PP_VARIADIC_ELEM(0,__VA_ARGS__), \
52 BOOST_VMD_EMPTY, \
53 BOOST_VMD_DETAIL_ASSERT_TRUE \
54 ) \
55 (__VA_ARGS__) \
56/**/
57
58#else
59
60#define BOOST_VMD_DETAIL_ASSERT_DO(cond) \
61 BOOST_PP_ASSERT(cond) \
62/**/
63
64#define BOOST_VMD_DETAIL_ASSERT(...) \
65 BOOST_VMD_DETAIL_ASSERT_DO(BOOST_PP_VARIADIC_ELEM(0,__VA_ARGS__)) \
66/**/
67
68#endif /* BOOST_VMD_MSVC */
69#endif /* BOOST_VMD_DETAIL_ASSERT_HPP */