]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/preprocessor/test/isempty.cxx
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / preprocessor / test / isempty.cxx
1 # /* **************************************************************************
2 # * *
3 # * (C) Copyright Edward Diener 2014.
4 # * Distributed under the Boost Software License, Version 1.0. (See
5 # * accompanying file LICENSE_1_0.txt or copy at
6 # * http://www.boost.org/LICENSE_1_0.txt)
7 # * *
8 # ************************************************************************** */
9 #
10 # /* See http://www.boost.org for most recent version. */
11 #
12 # include <boost/preprocessor/config/config.hpp>
13 #
14 #if (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) || (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC())
15
16 # include <boost/preprocessor/facilities/empty.hpp>
17 # include <boost/preprocessor/facilities/is_empty.hpp>
18 # include <libs/preprocessor/test/test.h>
19
20 #define DATA
21 #define OBJECT OBJECT2
22 #define OBJECT2
23 #define FUNC(x) FUNC2(x)
24 #define FUNC2(x)
25 #define FUNC_GEN() ()
26 #define FUNC_GEN2(x) ()
27 #define FUNC_GEN3() (&)
28 #define FUNC_GEN4(x) (y)
29 #define FUNC_GEN5() (y,z)
30 #define FUNC_GEN6() anything
31 #define FUNC_GEN7(x) anything
32 #define FUNC_GEN8(x,y) (1,2,3)
33 #define FUNC_GEN9(x,y,z) anything
34 #define FUNC_GEN10(x) (y) data
35 #define NAME &name
36 #define ATUPLE (atuple)
37 #define ATUPLE_PLUS (atuple) data
38
39 #if BOOST_PP_VARIADICS
40
41 #if BOOST_PP_VARIADICS_MSVC /* Testing the VC++ variadic version */
42
43 /* INCORRECT */
44
45 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 1 END
46 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 1 END
47 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 1 END
48 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 1 END
49 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 1 END
50 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 1 END
51 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 1 END
52
53 /* CORRECT */
54
55 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END
56
57 #else /* Testing the non-VC++ variadic version */
58
59 /* CORRECT */
60
61 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 0 END
62 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 0 END
63 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END
64 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END
65 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 0 END
66 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 0 END
67
68 /* COMPILER ERROR */
69
70 // BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END
71 // BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END
72
73 #endif
74
75 /* Testing the variadic version */
76
77 /* CORRECT */
78
79 BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_EMPTY()) == 1 END
80 BEGIN BOOST_PP_IS_EMPTY(DATA BOOST_PP_EMPTY()) == 1 END
81 BEGIN BOOST_PP_IS_EMPTY(x BOOST_PP_EMPTY()) == 0 END
82 BEGIN BOOST_PP_IS_EMPTY(OBJECT BOOST_PP_EMPTY()) == 1 END
83 BEGIN BOOST_PP_IS_EMPTY(FUNC(z) BOOST_PP_EMPTY()) == 1 END
84 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN6) == 0 END
85 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN7) == 0 END
86 BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END
87 BEGIN BOOST_PP_IS_EMPTY(ATUPLE) == 0 END
88 BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 0 END
89
90 #else
91
92 #if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() /* Testing the VC++ non-variadic version */
93
94 /* INCORRECT */
95
96 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 1 END
97 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 1 END
98 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 1 END
99 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 1 END
100 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 1 END
101 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 1 END
102 BEGIN BOOST_PP_IS_EMPTY(ATUPLE) == 1 END
103 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 1 END
104 BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 1 END
105
106 /* CORRECT */
107
108 BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END
109
110 #else /* Testing the non-VC++ non-variadic version */
111
112 /* CORRECT */
113
114 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 0 END
115 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 0 END
116 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END
117 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END
118 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 0 END
119 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END
120 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 0 END
121
122 /* UNDEFINED BEHAVIOR */
123
124 // BEGIN BOOST_PP_IS_EMPTY(ATUPLE) == 0 END
125 // BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 1 END
126 // BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END
127
128 #endif
129
130 /* Testing the non-variadic version */
131
132 /* CORRECT */
133
134 BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_EMPTY()) == 1 END
135 BEGIN BOOST_PP_IS_EMPTY(DATA BOOST_PP_EMPTY()) == 1 END
136 BEGIN BOOST_PP_IS_EMPTY(x BOOST_PP_EMPTY()) == 0 END
137 BEGIN BOOST_PP_IS_EMPTY(OBJECT BOOST_PP_EMPTY()) == 1 END
138 BEGIN BOOST_PP_IS_EMPTY(FUNC(z) BOOST_PP_EMPTY()) == 1 END
139 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN6) == 0 END
140 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN7) == 0 END
141 BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END
142
143 #endif
144
145 #endif