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 "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# include <boost/preprocessor/variadic/has_opt.hpp>
40
41#if defined(__cplusplus) && __cplusplus > 201703L && BOOST_PP_VARIADIC_HAS_OPT()
42
43BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 0 END
44BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 0 END
45BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END
46BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END
47BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 0 END
48BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END
49BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END
50BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 0 END
51
52#elif BOOST_PP_VARIADICS_MSVC /* Testing the VC++ variadic version */
53
54/* INCORRECT */
55
56BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 1 END
57BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 1 END
58BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 1 END
59BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 1 END
60BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 1 END
61BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 1 END
62BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 1 END
63
64/* CORRECT */
65
66BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END
67
68#else /* Testing the non-VC++ variadic version */
69
70/* CORRECT */
71
72BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 0 END
73BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 0 END
74BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END
75BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END
76BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 0 END
77BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 0 END
78
79/* COMPILER ERROR */
80
81// BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END
82// BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END
83
84#endif
85
86/* Testing the variadic version */
87
88/* CORRECT */
89
90BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_EMPTY()) == 1 END
91BEGIN BOOST_PP_IS_EMPTY(DATA BOOST_PP_EMPTY()) == 1 END
92BEGIN BOOST_PP_IS_EMPTY(x BOOST_PP_EMPTY()) == 0 END
93BEGIN BOOST_PP_IS_EMPTY(OBJECT BOOST_PP_EMPTY()) == 1 END
94BEGIN BOOST_PP_IS_EMPTY(FUNC(z) BOOST_PP_EMPTY()) == 1 END
95BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN6) == 0 END
96BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN7) == 0 END
97BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END
98BEGIN BOOST_PP_IS_EMPTY(ATUPLE) == 0 END
99BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 0 END
100
101#endif
102

source code of boost/libs/preprocessor/test/isempty.cxx