]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/assert/test/assert_is_void_test.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / assert / test / assert_is_void_test.cpp
1 //
2 // assert_is_void_test.cpp - tests BOOST_ASSERT_IS_VOID
3 //
4 // Copyright (c) 2015 Ion Gaztanaga
5 //
6 // Distributed under the Boost Software License, Version 1.0.
7 // See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt
9 //
10
11 #include <boost/config.hpp>
12
13 // default case, !NDEBUG
14 // BOOST_ASSERT(x) -> assert(x)
15
16 #undef NDEBUG
17 #include <boost/assert.hpp>
18
19 #ifdef BOOST_ASSERT_IS_VOID
20 #error "BOOST_ASSERT should NOT be void if NDEBUG is not defined"
21 #endif
22
23 // default case, NDEBUG
24 // BOOST_ASSERT(x) -> assert(x)
25
26 #define NDEBUG
27 #include <boost/assert.hpp>
28
29 #ifndef BOOST_ASSERT_IS_VOID
30 #error "Error: BOOST_ASSERT should be void in NDEBUG"
31 #endif
32
33 // BOOST_DISABLE_ASSERTS, !NDEBUG
34 // BOOST_ASSERT(x) -> ((void)0)
35
36 #define BOOST_DISABLE_ASSERTS
37
38 #undef NDEBUG
39 #include <boost/assert.hpp>
40
41 #ifndef BOOST_ASSERT_IS_VOID
42 #error "Error: BOOST_ASSERT should be void with BOOST_DISABLE_ASSERTS"
43 #endif
44
45 // BOOST_DISABLE_ASSERTS, NDEBUG
46 // BOOST_ASSERT(x) -> ((void)0)
47
48 #define NDEBUG
49 #include <boost/assert.hpp>
50
51 #ifndef BOOST_ASSERT_IS_VOID
52 #error "Error: BOOST_ASSERT should be void with BOOST_DISABLE_ASSERTS and NDEBUG"
53 #endif
54
55 #undef BOOST_DISABLE_ASSERTS
56
57 // BOOST_ENABLE_ASSERT_HANDLER, !NDEBUG
58 // BOOST_ASSERT(expr) -> (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
59
60 #define BOOST_ENABLE_ASSERT_HANDLER
61
62 #undef NDEBUG
63 #include <boost/assert.hpp>
64
65 #ifdef BOOST_ASSERT_IS_VOID
66 #error "Error: BOOST_ASSERT should NOT be void with BOOST_ENABLE_ASSERT_HANDLER"
67 #endif
68
69 // BOOST_ENABLE_ASSERT_HANDLER, NDEBUG
70 // BOOST_ASSERT(expr) -> (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
71
72 #define NDEBUG
73 #include <boost/assert.hpp>
74
75 #ifdef BOOST_ASSERT_IS_VOID
76 #error "Error: BOOST_ASSERT should NOT be void with BOOST_ENABLE_ASSERT_HANDLER"
77 #endif
78
79 #undef BOOST_ENABLE_ASSERT_HANDLER
80
81 // BOOST_ENABLE_ASSERT_DEBUG_HANDLER, !NDEBUG
82 // same as BOOST_ENABLE_ASSERT_HANDLER
83
84 #define BOOST_ENABLE_ASSERT_DEBUG_HANDLER
85
86 #undef NDEBUG
87 #include <boost/assert.hpp>
88
89 #ifdef BOOST_ASSERT_IS_VOID
90 #error "Error: BOOST_ASSERT should NOT be void with BOOST_ENABLE_ASSERT_DEBUG_HANDLER and !NDEBUG"
91 #endif
92
93 // BOOST_ENABLE_ASSERT_DEBUG_HANDLER, NDEBUG
94 // BOOST_ASSERT(x) -> ((void)0)
95
96 #define NDEBUG
97 #include <boost/assert.hpp>
98
99 #ifndef BOOST_ASSERT_IS_VOID
100 #error "Error: BOOST_ASSERT should be void with BOOST_ENABLE_ASSERT_DEBUG_HANDLER and NDEBUG"
101 #endif
102
103 #undef BOOST_ENABLE_ASSERT_DEBUG_HANDLER
104
105 int main()
106 {
107 return 0;
108 }