Addition of is_empty tests and changes to rem processing as a workaround to VC++ problem.

This commit is contained in:
Edward Diener
2014-04-30 16:06:49 -04:00
parent 2c7cf9410a
commit 4ed6f6e07a
24 changed files with 476 additions and 66 deletions

View File

@ -11,12 +11,8 @@
#
# include <boost/preprocessor/facilities/empty.hpp>
# include <boost/preprocessor/facilities/is_empty.hpp>
# include <boost/preprocessor/facilities/is_empty_or_1.hpp>
# include <boost/preprocessor/facilities/is_1.hpp>
# include <libs/preprocessor/test/test.h>
#if BOOST_PP_VARIADICS
#define DATA
#define OBJECT OBJECT2
#define OBJECT2
@ -29,38 +25,53 @@
#define FUNC_GEN5() (y,z)
#define FUNC_GEN6() anything
#define FUNC_GEN7(x) anything
#if defined(BOOST_PP_VARIADICS_MSVC)
#define FUNC_GEN8(x,y) (1,2,3)
#define FUNC_GEN9(x,y,z) anything
/* These next five produce the wrong result in VC++ */
#define FUNC_GEN10(x) (y) data
#define NAME &name
#define ATUPLE (atuple)
#define ATUPLE_PLUS (atuple) data
#if BOOST_PP_VARIADICS
#if defined(BOOST_PP_VARIADICS_MSVC) /* Testing the VC++ variadic version */
/* INCORRECT */
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 1 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 1 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 1 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 1 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 1 END
/* This next should produce a compiler error but does not, and produces the incorrect result */
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 1 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 1 END
/* This next should produce a compiler error but does not */
/* CORRECT */
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END
#else
#else /* Testing the non-VC++ variadic version */
/* CORRECT */
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 0 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 0 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 0 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 0 END
/* COMPILER ERROR */
// BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END
// BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END
#endif
/* Testing the variadic version */
/* CORRECT */
BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_EMPTY()) == 1 END
BEGIN BOOST_PP_IS_EMPTY(DATA BOOST_PP_EMPTY()) == 1 END
BEGIN BOOST_PP_IS_EMPTY(x BOOST_PP_EMPTY()) == 0 END
@ -68,5 +79,61 @@ BEGIN BOOST_PP_IS_EMPTY(OBJECT BOOST_PP_EMPTY()) == 1 END
BEGIN BOOST_PP_IS_EMPTY(FUNC(z) BOOST_PP_EMPTY()) == 1 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN6) == 0 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN7) == 0 END
BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END
BEGIN BOOST_PP_IS_EMPTY(ATUPLE) == 0 END
BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 0 END
#else
#if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() /* Testing the VC++ non-variadic version */
/* INCORRECT */
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 1 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 1 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 1 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 1 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 1 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 1 END
BEGIN BOOST_PP_IS_EMPTY(ATUPLE) == 1 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 1 END
BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 1 END
/* CORRECT */
BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END
#else /* Testing the non-VC++ non-variadic version */
/* CORRECT */
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 0 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 0 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 0 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 0 END
/* COMPILER ERROR */
// BEGIN BOOST_PP_IS_EMPTY(ATUPLE) == 0 END
// BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 1 END
// BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END
#endif
/* Testing the non-variadic version */
/* CORRECT */
BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_EMPTY()) == 1 END
BEGIN BOOST_PP_IS_EMPTY(DATA BOOST_PP_EMPTY()) == 1 END
BEGIN BOOST_PP_IS_EMPTY(x BOOST_PP_EMPTY()) == 0 END
BEGIN BOOST_PP_IS_EMPTY(OBJECT BOOST_PP_EMPTY()) == 1 END
BEGIN BOOST_PP_IS_EMPTY(FUNC(z) BOOST_PP_EMPTY()) == 1 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN6) == 0 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN7) == 0 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END
#endif