diff --git a/include/boost/preprocessor/array/detail/get_data.hpp b/include/boost/preprocessor/array/detail/get_data.hpp index d72547a..d978109 100644 --- a/include/boost/preprocessor/array/detail/get_data.hpp +++ b/include/boost/preprocessor/array/detail/get_data.hpp @@ -23,9 +23,7 @@ # # /* BOOST_PP_ARRAY_DETAIL_GET_DATA */ # -# define BOOST_PP_ARRAY_DETAIL_GET_DATA_REM(...) BOOST_PP_CAT(__VA_ARGS__,) -# define BOOST_PP_ARRAY_DETAIL_GET_DATA_TUPLE_REM(size) BOOST_PP_ARRAY_DETAIL_GET_DATA_REM -# define BOOST_PP_ARRAY_DETAIL_GET_DATA_SINGLE(size, data) BOOST_PP_ARRAY_DETAIL_GET_DATA_TUPLE_REM(size) data +# define BOOST_PP_ARRAY_DETAIL_GET_DATA_SINGLE(size, data) BOOST_PP_TUPLE_REM_CAT(size) data # define BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY(size, data) BOOST_PP_TUPLE_REM(size) data # define BOOST_PP_ARRAY_DETAIL_GET_DATA_CHECK_ZERO(size, data) \ BOOST_PP_IF \ diff --git a/include/boost/preprocessor/facilities/is_empty.hpp b/include/boost/preprocessor/facilities/is_empty.hpp index b1094d8..e7f821f 100644 --- a/include/boost/preprocessor/facilities/is_empty.hpp +++ b/include/boost/preprocessor/facilities/is_empty.hpp @@ -22,10 +22,13 @@ # else # # include -# include +# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() && ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() # include # include +# else +# include # include +# endif # # /* BOOST_PP_IS_EMPTY */ # diff --git a/include/boost/preprocessor/seq/detail/binary_transform.hpp b/include/boost/preprocessor/seq/detail/binary_transform.hpp index 373e8a5..1c381a7 100644 --- a/include/boost/preprocessor/seq/detail/binary_transform.hpp +++ b/include/boost/preprocessor/seq/detail/binary_transform.hpp @@ -16,6 +16,9 @@ # include # include # include +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC +# include +# endif # # /* BOOST_PP_SEQ_BINARY_TRANSFORM */ # @@ -28,8 +31,15 @@ # define BOOST_PP_SEQ_BINARY_TRANSFORM(seq) BOOST_PP_CAT(BOOST_PP_SEQ_BINARY_TRANSFORM_A seq, 0) # endif # if BOOST_PP_VARIADICS -# define BOOST_PP_SEQ_BINARY_TRANSFORM_A(...) (BOOST_PP_REM, __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_B -# define BOOST_PP_SEQ_BINARY_TRANSFORM_B(...) (BOOST_PP_REM, __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_A +# if BOOST_PP_VARIADICS_MSVC +# define BOOST_PP_SEQ_BINARY_TRANSFORM_GET_REM(...) \ + BOOST_PP_VARIADIC_IS_SINGLE_RETURN(BOOST_PP_REM_CAT,BOOST_PP_REM,__VA_ARGS__) \ + /**/ +# else +# define BOOST_PP_SEQ_BINARY_TRANSFORM_GET_REM(...) BOOST_PP_REM +# endif +# define BOOST_PP_SEQ_BINARY_TRANSFORM_A(...) (BOOST_PP_SEQ_BINARY_TRANSFORM_GET_REM(__VA_ARGS__), __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_B +# define BOOST_PP_SEQ_BINARY_TRANSFORM_B(...) (BOOST_PP_SEQ_BINARY_TRANSFORM_GET_REM(__VA_ARGS__), __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_A # else # define BOOST_PP_SEQ_BINARY_TRANSFORM_A(e) (BOOST_PP_REM, e)() BOOST_PP_SEQ_BINARY_TRANSFORM_B # define BOOST_PP_SEQ_BINARY_TRANSFORM_B(e) (BOOST_PP_REM, e)() BOOST_PP_SEQ_BINARY_TRANSFORM_A diff --git a/include/boost/preprocessor/tuple/detail/is_single_return.hpp b/include/boost/preprocessor/tuple/detail/is_single_return.hpp new file mode 100644 index 0000000..9ffa3cc --- /dev/null +++ b/include/boost/preprocessor/tuple/detail/is_single_return.hpp @@ -0,0 +1,28 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. * +# * Distributed under the Boost Software License, Version 1.0. (See * +# * accompanying file LICENSE_1_0.txt or copy at * +# * http://www.boost.org/LICENSE_1_0.txt) * +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# ifndef BOOST_PREPROCESSOR_TUPLE_DETAIL_IS_SINGLE_RETURN_HPP +# define BOOST_PREPROCESSOR_TUPLE_DETAIL_IS_SINGLE_RETURN_HPP +# +# include +# include +# include +# include +# +# /* BOOST_PP_TUPLE_IS_SINGLE_RETURN */ +# +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC +# define BOOST_PP_TUPLE_IS_SINGLE_RETURN(sr,nsr,tuple) \ + BOOST_PP_IIF(BOOST_PP_IS_1(BOOST_PP_TUPLE_SIZE(tuple)),sr,nsr) \ + /**/ +# endif /* BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC */ +# +# endif /* BOOST_PREPROCESSOR_TUPLE_DETAIL_IS_SINGLE_RETURN_HPP */ diff --git a/include/boost/preprocessor/tuple/elem.hpp b/include/boost/preprocessor/tuple/elem.hpp index 762a171..ee8f0bd 100644 --- a/include/boost/preprocessor/tuple/elem.hpp +++ b/include/boost/preprocessor/tuple/elem.hpp @@ -22,9 +22,7 @@ # include # # if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC -# include -# include -# include +# include # endif # # if BOOST_PP_VARIADICS @@ -33,21 +31,12 @@ # define BOOST_PP_TUPLE_ELEM_I(m, args) BOOST_PP_TUPLE_ELEM_II(m, args) # define BOOST_PP_TUPLE_ELEM_II(m, args) BOOST_PP_CAT(m ## args,) /* - Use BOOST_PP_TUPLE_ELEM_O_2_CAT if it is a single element tuple ( which might be empty ) + Use BOOST_PP_REM_CAT if it is a single element tuple ( which might be empty ) else use BOOST_PP_REM. This fixes a VC++ problem with an empty tuple and BOOST_PP_TUPLE_ELEM - functionality. + functionality. See tuple_elem_bug_test.cxx. */ -# define BOOST_PP_TUPLE_ELEM_O_2_CAT(...) BOOST_PP_CAT(__VA_ARGS__,) -# define BOOST_PP_TUPLE_ELEM_O_2_SINGLE(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_TUPLE_ELEM_O_2_CAT tuple) -# define BOOST_PP_TUPLE_ELEM_O_2_ANY(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_REM tuple) # define BOOST_PP_TUPLE_ELEM_O_2(n, tuple) \ - BOOST_PP_IIF \ - ( \ - BOOST_PP_EQUAL(BOOST_PP_TUPLE_SIZE(tuple),1), \ - BOOST_PP_TUPLE_ELEM_O_2_SINGLE, \ - BOOST_PP_TUPLE_ELEM_O_2_ANY \ - ) \ - (n, tuple) \ + BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_TUPLE_IS_SINGLE_RETURN(BOOST_PP_REM_CAT,BOOST_PP_REM,tuple) tuple) \ /**/ # else # define BOOST_PP_TUPLE_ELEM(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_ELEM_O_, __VA_ARGS__)(__VA_ARGS__) diff --git a/include/boost/preprocessor/tuple/rem.hpp b/include/boost/preprocessor/tuple/rem.hpp index 270c31a..136d282 100644 --- a/include/boost/preprocessor/tuple/rem.hpp +++ b/include/boost/preprocessor/tuple/rem.hpp @@ -16,10 +16,17 @@ # include # include # include +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC +# include +# endif # # /* BOOST_PP_REM */ # # if BOOST_PP_VARIADICS +# if BOOST_PP_VARIADICS_MSVC + /* To be used internally when __VA_ARGS__ is a single element */ +# define BOOST_PP_REM_CAT(...) BOOST_PP_CAT(__VA_ARGS__,) +# endif # define BOOST_PP_REM(...) __VA_ARGS__ # else # define BOOST_PP_REM(x) x @@ -31,6 +38,10 @@ VC++8.0 cannot handle the variadic version of BOOST_PP_TUPLE_REM(size) */ # if BOOST_PP_VARIADICS && !(BOOST_PP_VARIADICS_MSVC && _MSC_VER == 1400) +# if BOOST_PP_VARIADICS_MSVC + /* To be used internally when the size is 1 */ +# define BOOST_PP_TUPLE_REM_CAT(size) BOOST_PP_REM_CAT +# endif # define BOOST_PP_TUPLE_REM(size) BOOST_PP_REM # else # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() @@ -114,10 +125,11 @@ # define BOOST_PP_TUPLE_REM_CTOR(...) BOOST_PP_TUPLE_REM_CTOR_I(BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_REM_CTOR_O_, __VA_ARGS__), (__VA_ARGS__)) # define BOOST_PP_TUPLE_REM_CTOR_I(m, args) BOOST_PP_TUPLE_REM_CTOR_II(m, args) # define BOOST_PP_TUPLE_REM_CTOR_II(m, args) BOOST_PP_CAT(m ## args,) +# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_TUPLE_IS_SINGLE_RETURN(BOOST_PP_REM_CAT,BOOST_PP_REM,tuple) tuple # else # define BOOST_PP_TUPLE_REM_CTOR(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_REM_CTOR_O_, __VA_ARGS__)(__VA_ARGS__) +# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_REM tuple # endif -# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_REM tuple # define BOOST_PP_TUPLE_REM_CTOR_O_2(size, tuple) BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) # else # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() diff --git a/include/boost/preprocessor/variadic/detail/is_single_return.hpp b/include/boost/preprocessor/variadic/detail/is_single_return.hpp new file mode 100644 index 0000000..491e06b --- /dev/null +++ b/include/boost/preprocessor/variadic/detail/is_single_return.hpp @@ -0,0 +1,28 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. * +# * Distributed under the Boost Software License, Version 1.0. (See * +# * accompanying file LICENSE_1_0.txt or copy at * +# * http://www.boost.org/LICENSE_1_0.txt) * +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# ifndef BOOST_PREPROCESSOR_VARIADIC_DETAIL_IS_SINGLE_RETURN_HPP +# define BOOST_PREPROCESSOR_VARIADIC_DETAIL_IS_SINGLE_RETURN_HPP +# +# include +# include +# include +# include +# +# /* BOOST_PP_VARIADIC_IS_SINGLE_RETURN */ +# +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC +# define BOOST_PP_VARIADIC_IS_SINGLE_RETURN(sr,nsr,...) \ + BOOST_PP_IIF(BOOST_PP_IS_1(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__)),sr,nsr) \ + /**/ +# endif /* BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC */ +# +# endif /* BOOST_PREPROCESSOR_VARIADIC_DETAIL_IS_SINGLE_RETURN_HPP */ diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 527fc22..ac61214 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -19,23 +19,22 @@ project preprocessor_tests : requirements on test-suite preprocessor : - [ compile arithmetic.cpp ] - [ compile array.cpp ] - [ compile comparison.cpp ] - [ compile control.cpp ] - [ compile debug.cpp ] - [ compile facilities.cpp ] - [ compile isempty.cpp ] - [ compile iteration.cpp ] - [ compile list.cpp ] - [ compile logical.cpp ] - [ compile punctuation.cpp ] - [ compile repetition.cpp ] - [ compile selection.cpp ] - [ compile seq.cpp ] - [ compile slot.cpp ] - [ compile tuple.cpp ] - [ compile variadic.cpp ] + [ compile arithmetic.cpp : gcc:-std=c++0x ] + [ compile array.cpp : gcc:-std=c++0x ] + [ compile comparison.cpp : gcc:-std=c++0x ] + [ compile control.cpp : gcc:-std=c++0x ] + [ compile debug.cpp : gcc:-std=c++0x ] + [ compile facilities.cpp : gcc:-std=c++0x ] + [ compile iteration.cpp : gcc:-std=c++0x ] + [ compile list.cpp : gcc:-std=c++0x ] + [ compile logical.cpp : gcc:-std=c++0x ] + [ compile punctuation.cpp : gcc:-std=c++0x ] + [ compile repetition.cpp : gcc:-std=c++0x ] + [ compile selection.cpp : gcc:-std=c++0x ] + [ compile seq.cpp : gcc:-std=c++0x ] + [ compile slot.cpp : gcc:-std=c++0x ] + [ compile tuple.cpp : gcc:-std=c++0x ] + [ compile variadic.cpp : gcc:-std=c++0x ] ; test-suite preprocessor_nvm @@ -46,7 +45,6 @@ test-suite preprocessor_nvm [ compile control.cpp : BOOST_PP_VARIADICS=0 : control_nvm ] [ compile debug.cpp : BOOST_PP_VARIADICS=0 : debug_nvm ] [ compile facilities.cpp : BOOST_PP_VARIADICS=0 : facilities_nvm ] - [ compile isempty.cpp : BOOST_PP_VARIADICS=0 : isempty_nvm ] [ compile iteration.cpp : BOOST_PP_VARIADICS=0 : iteration_nvm ] [ compile list.cpp : BOOST_PP_VARIADICS=0 : list_nvm ] [ compile logical.cpp : BOOST_PP_VARIADICS=0 : logical_nvm ] @@ -83,10 +81,6 @@ test-suite preprocessor_c : gcc:-std=c99 : facilities_c ] - [ compile isempty.c - : gcc:-std=c99 - : isempty_c - ] [ compile list.c : gcc:-std=c99 : list_c @@ -153,11 +147,6 @@ test-suite preprocessor_c_nvm gcc:-std=c99 : facilities_c_nvm ] - [ compile isempty.c - : BOOST_PP_VARIADICS=0 - gcc:-std=c99 - : isempty_c_nvm - ] [ compile list.c : BOOST_PP_VARIADICS=0 gcc:-std=c99 @@ -189,3 +178,52 @@ test-suite preprocessor_c_nvm : tuple_c_nvm ] ; + +# test-suite preprocessor_isempty +# : +# [ compile isempty.cpp : gcc:-std=c++0x ] +# [ compile-fail isempty_variadic_standard_failure.cpp : gcc:-std=c++0x ] +# [ compile-fail isempty_variadic_standard_failure2.cpp : gcc:-std=c++0x ] +# ; + +test-suite preprocessor_isempty_nvm + : + [ compile isempty.cpp : BOOST_PP_VARIADICS=0 : isempty_nvm ] + [ compile-fail isempty_failure.cpp : BOOST_PP_VARIADICS=0 : isempty_failure_nvm ] + [ compile-fail isempty_failure2.cpp : BOOST_PP_VARIADICS=0 : isempty_failure2_nvm ] + ; + +# test-suite preprocessor_isempty_c +# : +# [ compile isempty.c +# : gcc:-std=c99 +# : isempty_c +# ] +# [ compile-fail isempty_variadic_standard_failure.c +# : gcc:-std=c99 +# : isempty_variadic_standard_failure_c +# ] +# [ compile-fail isempty_variadic_standard_failure2.c +# : gcc:-std=c99 +# : isempty_variadic_standard_failure2_c +# ] +# ; + +test-suite preprocessor_isempty_c_nvm + : + [ compile isempty.c + : BOOST_PP_VARIADICS=0 + gcc:-std=c99 + : isempty_c_nvm + ] + [ compile-fail isempty_failure.c + : BOOST_PP_VARIADICS=0 + gcc:-std=c99 + : isempty_failure_c_nvm + ] + [ compile-fail isempty_failure2.c + : BOOST_PP_VARIADICS=0 + gcc:-std=c99 + : isempty_failure2_c_nvm + ] + ; diff --git a/test/isempty.cpp b/test/isempty.cpp index a038bf4..bd4c2c6 100644 --- a/test/isempty.cpp +++ b/test/isempty.cpp @@ -1,6 +1,6 @@ # /* ************************************************************************** # * * -# * (C) Copyright Paul Mensonides 2002. +# * (C) Copyright Edward Diener 2014. # * Distributed under the Boost Software License, Version 1.0. (See # * accompanying file LICENSE_1_0.txt or copy at # * http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/isempty.cxx b/test/isempty.cxx index 94be43a..cf2660f 100644 --- a/test/isempty.cxx +++ b/test/isempty.cxx @@ -11,12 +11,8 @@ # # include # include -# include -# include # include -#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 diff --git a/test/isempty_failure.c b/test/isempty_failure.c new file mode 100644 index 0000000..db891ba --- /dev/null +++ b/test/isempty_failure.c @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * Distributed under the Boost Software License, Version 1.0. (See +# * accompanying file LICENSE_1_0.txt or copy at +# * http://www.boost.org/LICENSE_1_0.txt) +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# include diff --git a/test/isempty_failure.cpp b/test/isempty_failure.cpp new file mode 100644 index 0000000..db891ba --- /dev/null +++ b/test/isempty_failure.cpp @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * Distributed under the Boost Software License, Version 1.0. (See +# * accompanying file LICENSE_1_0.txt or copy at +# * http://www.boost.org/LICENSE_1_0.txt) +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# include diff --git a/test/isempty_failure.cxx b/test/isempty_failure.cxx new file mode 100644 index 0000000..f6a4179 --- /dev/null +++ b/test/isempty_failure.cxx @@ -0,0 +1,25 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * Distributed under the Boost Software License, Version 1.0. (See +# * accompanying file LICENSE_1_0.txt or copy at +# * http://www.boost.org/LICENSE_1_0.txt) +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# include +# include + +#if !BOOST_PP_VARIADICS && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()) + +#define NAME &name + +BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END + +#else + +BEGIN 1 == 0 END + +#endif diff --git a/test/isempty_failure2.c b/test/isempty_failure2.c new file mode 100644 index 0000000..cb5aa2e --- /dev/null +++ b/test/isempty_failure2.c @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * Distributed under the Boost Software License, Version 1.0. (See +# * accompanying file LICENSE_1_0.txt or copy at +# * http://www.boost.org/LICENSE_1_0.txt) +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# include diff --git a/test/isempty_failure2.cpp b/test/isempty_failure2.cpp new file mode 100644 index 0000000..cb5aa2e --- /dev/null +++ b/test/isempty_failure2.cpp @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * Distributed under the Boost Software License, Version 1.0. (See +# * accompanying file LICENSE_1_0.txt or copy at +# * http://www.boost.org/LICENSE_1_0.txt) +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# include diff --git a/test/isempty_failure2.cxx b/test/isempty_failure2.cxx new file mode 100644 index 0000000..397774b --- /dev/null +++ b/test/isempty_failure2.cxx @@ -0,0 +1,25 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * Distributed under the Boost Software License, Version 1.0. (See +# * accompanying file LICENSE_1_0.txt or copy at +# * http://www.boost.org/LICENSE_1_0.txt) +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# include +# include + +#if !BOOST_PP_VARIADICS && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()) + +#define ATUPLE_PLUS (atuple) data + +BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 0 END + +#else + +BEGIN 1 == 0 END + +#endif diff --git a/test/isempty_variadic_standard_failure.c b/test/isempty_variadic_standard_failure.c new file mode 100644 index 0000000..36f6ff7 --- /dev/null +++ b/test/isempty_variadic_standard_failure.c @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * Distributed under the Boost Software License, Version 1.0. (See +# * accompanying file LICENSE_1_0.txt or copy at +# * http://www.boost.org/LICENSE_1_0.txt) +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# include diff --git a/test/isempty_variadic_standard_failure.cpp b/test/isempty_variadic_standard_failure.cpp new file mode 100644 index 0000000..36f6ff7 --- /dev/null +++ b/test/isempty_variadic_standard_failure.cpp @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * Distributed under the Boost Software License, Version 1.0. (See +# * accompanying file LICENSE_1_0.txt or copy at +# * http://www.boost.org/LICENSE_1_0.txt) +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# include diff --git a/test/isempty_variadic_standard_failure.cxx b/test/isempty_variadic_standard_failure.cxx new file mode 100644 index 0000000..d4403bf --- /dev/null +++ b/test/isempty_variadic_standard_failure.cxx @@ -0,0 +1,25 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * Distributed under the Boost Software License, Version 1.0. (See +# * accompanying file LICENSE_1_0.txt or copy at +# * http://www.boost.org/LICENSE_1_0.txt) +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# include +# include + +#if BOOST_PP_VARIADICS && !defined(BOOST_PP_VARIADICS_MSVC) + +#define FUNC_GEN8(x,y) (1,2,3) + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END + +#else + +BEGIN 1 == 0 END + +#endif diff --git a/test/isempty_variadic_standard_failure2.c b/test/isempty_variadic_standard_failure2.c new file mode 100644 index 0000000..a2aa690 --- /dev/null +++ b/test/isempty_variadic_standard_failure2.c @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * Distributed under the Boost Software License, Version 1.0. (See +# * accompanying file LICENSE_1_0.txt or copy at +# * http://www.boost.org/LICENSE_1_0.txt) +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# include diff --git a/test/isempty_variadic_standard_failure2.cpp b/test/isempty_variadic_standard_failure2.cpp new file mode 100644 index 0000000..a2aa690 --- /dev/null +++ b/test/isempty_variadic_standard_failure2.cpp @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * Distributed under the Boost Software License, Version 1.0. (See +# * accompanying file LICENSE_1_0.txt or copy at +# * http://www.boost.org/LICENSE_1_0.txt) +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# include diff --git a/test/isempty_variadic_standard_failure2.cxx b/test/isempty_variadic_standard_failure2.cxx new file mode 100644 index 0000000..38a6600 --- /dev/null +++ b/test/isempty_variadic_standard_failure2.cxx @@ -0,0 +1,25 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * Distributed under the Boost Software License, Version 1.0. (See +# * accompanying file LICENSE_1_0.txt or copy at +# * http://www.boost.org/LICENSE_1_0.txt) +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# include +# include + +#if BOOST_PP_VARIADICS && !defined(BOOST_PP_VARIADICS_MSVC) + +#define FUNC_GEN9(x,y,z) anything + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END + +#else + +BEGIN 1 == 0 END + +#endif diff --git a/test/tuple.cxx b/test/tuple.cxx index d5d941a..c315509 100644 --- a/test/tuple.cxx +++ b/test/tuple.cxx @@ -7,10 +7,12 @@ # * * # ************************************************************************** */ # -# /* Revised by Edward Diener (2011) */ +# /* Revised by Edward Diener (2011,2014) */ # # /* See http://www.boost.org for most recent version. */ # +# include +# include # include # include # include @@ -20,6 +22,7 @@ # include # endif # include +# include # define TUPLE (0, 1, 2, 3, 4, 5) # define TUPLE_LARGE (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32) diff --git a/test/tuple_elem_bug_test.cxx b/test/tuple_elem_bug_test.cxx new file mode 100644 index 0000000..56e36a6 --- /dev/null +++ b/test/tuple_elem_bug_test.cxx @@ -0,0 +1,38 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * Distributed under the Boost Software License, Version 1.0. (See +# * accompanying file LICENSE_1_0.txt or copy at +# * http://www.boost.org/LICENSE_1_0.txt) +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# include +# include +# include +# include + +#define TN_GEN_ONE(p) (1) +#define TN_GEN_ZERO(p) (0) +#define TN_TEST_ONE_MORE(parameter,ens) \ + BOOST_PP_IF \ + ( \ + BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(1,0,ens),0), \ + TN_GEN_ONE, \ + TN_GEN_ZERO \ + ) \ + (parameter) \ +/**/ +#define TN_TEST_ONE(parameter,ens) \ + BOOST_PP_TUPLE_ELEM \ + ( \ + 1, \ + 0, \ + TN_TEST_ONE_MORE(parameter,ens) \ + ) \ +/**/ + +BEGIN TN_TEST_ONE(A,(1)) == 1 END +BEGIN TN_TEST_ONE(A,()) == 0 END