Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73314 - in branches/pplib/v2: boost/preprocessor/debug libs/preprocessor/test
From: eldiener_at_[hidden]
Date: 2011-07-23 21:42:01


Author: eldiener
Date: 2011-07-23 21:42:00 EDT (Sat, 23 Jul 2011)
New Revision: 73314
URL: http://svn.boost.org/trac/boost/changeset/73314

Log:
Updated ASSERT_IS_SEQ macro.
Text files modified:
   branches/pplib/v2/boost/preprocessor/debug/assert_is_seq.hpp | 153 ++++++++++++++++++++++++++++++++-------
   branches/pplib/v2/libs/preprocessor/test/Jamfile.v2 | 84 +++++++++++----------
   branches/pplib/v2/libs/preprocessor/test/debug.cxx | 6
   3 files changed, 173 insertions(+), 70 deletions(-)

Modified: branches/pplib/v2/boost/preprocessor/debug/assert_is_seq.hpp
==============================================================================
--- branches/pplib/v2/boost/preprocessor/debug/assert_is_seq.hpp (original)
+++ branches/pplib/v2/boost/preprocessor/debug/assert_is_seq.hpp 2011-07-23 21:42:00 EDT (Sat, 23 Jul 2011)
@@ -13,6 +13,7 @@
 # define BOOST_PREPROCESSOR_DEBUG_ASSERT_IS_SEQ_HPP
 #
 # include <boost/preprocessor/config/config.hpp>
+# include <boost/preprocessor/cat.hpp>
 # include <boost/preprocessor/comparison/equal.hpp>
 # include <boost/preprocessor/control/expr_iif.hpp>
 # include <boost/preprocessor/control/iif.hpp>
@@ -22,7 +23,8 @@
 # include <boost/preprocessor/facilities/is_tuple_begin.hpp>
 # include <boost/preprocessor/logical/not.hpp>
 # include <boost/preprocessor/variadic/size.hpp>
-#
+# include <boost/preprocessor/variadic/elem.hpp>
+#
 # /* BOOST_PP_ASSERT_IS_SEQ */
 #
 # if BOOST_PP_VARIADICS
@@ -32,28 +34,43 @@
 # else
 #
 # define BOOST_PP_ASSERT_IS_SEQ(x) \
+ BOOST_PP_IS_SEQ_DETAIL_EMPTY_F \
+ ( \
+ BOOST_PP_WHILE \
+ ( \
+ BOOST_PP_IS_SEQ_DETAIL_PRED, \
+ BOOST_PP_IS_SEQ_DETAIL_OP, \
+ x \
+ ) \
+ ) \
+/**/
+#
+# define BOOST_PP_IS_SEQ_DETAIL_PRED(d,state) \
     BOOST_PP_IIF \
       ( \
- BOOST_PP_IS_EMPTY(x), \
- BOOST_PP_IS_SEQ_DETAIL_GEN_RETURN_ASSERT_ERROR, \
- BOOST_PP_IS_SEQ_DETAIL_WHILE \
+ BOOST_PP_IS_TUPLE_BEGIN(state), \
+ BOOST_PP_IS_SEQ_DETAIL_GEN_ONE, \
+ BOOST_PP_IS_SEQ_DETAIL_PRED_CHECK_SUCCESS \
       ) \
- (x) \
+ (state) \
 /**/
 #
-# define BOOST_PP_IS_SEQ_DETAIL_WHILE(x) \
- BOOST_PP_WHILE \
+# define BOOST_PP_IS_SEQ_DETAIL_PRED_CHECK_SUCCESS(state) \
+ BOOST_PP_IIF \
       ( \
- BOOST_PP_IS_SEQ_DETAIL_PRED, \
- BOOST_PP_IS_SEQ_DETAIL_OP, \
- x \
+ BOOST_PP_IS_SEQ_DETAIL_IS_SUCCESS(state), \
+ BOOST_PP_IS_SEQ_DETAIL_GEN_ZERO, \
+ BOOST_PP_IS_SEQ_DETAIL_PRED_CHECK_FAILURE \
       ) \
+ (state) \
 /**/
 #
-# define BOOST_PP_IS_SEQ_DETAIL_PRED(d,state) \
- BOOST_PP_NOT \
+# define BOOST_PP_IS_SEQ_DETAIL_PRED_CHECK_FAILURE(state) \
+ BOOST_PP_IIF \
       ( \
- BOOST_PP_IS_EMPTY(state) \
+ BOOST_PP_IS_SEQ_DETAIL_IS_FAILURE(state), \
+ 0, \
+ 1 \
       ) \
 /**/
 #
@@ -61,12 +78,22 @@
     BOOST_PP_IIF \
       ( \
       BOOST_PP_IS_TUPLE_BEGIN(state), \
- BOOST_PP_IS_SEQ_DETAIL_CHECK_AFTER_FIRST_TUPLE, \
+ BOOST_PP_IS_SEQ_DETAIL_CHECK_FIRST_TUPLE_SIZE, \
       BOOST_PP_IS_SEQ_DETAIL_GEN_RETURN_ASSERT \
       ) \
     (state) \
 /**/
 #
+# define BOOST_PP_IS_SEQ_DETAIL_CHECK_FIRST_TUPLE_SIZE(state) \
+ BOOST_PP_IIF \
+ ( \
+ BOOST_PP_IS_SEQ_DETAIL_ASSERT_FIRST_TUPLE_SIZE(state), \
+ BOOST_PP_IS_SEQ_DETAIL_CHECK_AFTER_FIRST_TUPLE, \
+ BOOST_PP_IS_SEQ_DETAIL_GEN_FAILURE \
+ ) \
+ (state) \
+/**/
+#
 # define BOOST_PP_IS_SEQ_DETAIL_CHECK_AFTER_FIRST_TUPLE(state) \
     BOOST_PP_IIF \
       ( \
@@ -78,33 +105,72 @@
 /**/
 #
 # define BOOST_PP_IS_SEQ_DETAIL_ASSERT_SIZE(...) \
- BOOST_PP_ASSERT \
+ BOOST_PP_EQUAL \
+ ( \
+ BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), \
+ 1 \
+ ) \
+/**/
+#
+# define BOOST_PP_IS_SEQ_DETAIL_ASSERT_SIZE_AFTER(...) \
+ BOOST_PP_IIF \
       ( \
       BOOST_PP_EQUAL \
         ( \
         BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), \
         1 \
- ) \
+ ), \
+ BOOST_PP_IS_SEQ_DETAIL_GEN_ONE_COMMA, \
+ BOOST_PP_IS_SEQ_DETAIL_GEN_ZERO_COMMA \
       ) \
+ () \
 /**/
 #
 # define BOOST_PP_IS_SEQ_DETAIL_ASSERT_FIRST_TUPLE_SIZE(x) \
- BOOST_PP_IS_SEQ_DETAIL_EMPTY_E \
+ BOOST_PP_IIF \
       ( \
- BOOST_PP_IS_SEQ_DETAIL_APPLY(BOOST_PP_IS_SEQ_DETAIL_ASSERT_SIZE,x) \
+ BOOST_PP_IS_EMPTY \
+ ( \
+ BOOST_PP_IS_SEQ_DETAIL_GET_AFTER_FIRST_TUPLE(x) \
+ ), \
+ BOOST_PP_IS_SEQ_DETAIL_ASSERT_FIRST_TUPLE_SIZE_EMPTY, \
+ BOOST_PP_IS_SEQ_DETAIL_ASSERT_FIRST_TUPLE_SIZE_FULL \
       ) \
+ (x) \
 /**/
+#
+# define BOOST_PP_IS_SEQ_DETAIL_ASSERT_FIRST_TUPLE_SIZE_EMPTY(x) \
+ BOOST_PP_IS_SEQ_DETAIL_APPLY(BOOST_PP_IS_SEQ_DETAIL_ASSERT_SIZE,x) \
+/**/
+#
+# define BOOST_PP_IS_SEQ_DETAIL_ASSERT_FIRST_TUPLE_SIZE_FULL(x) \
+ BOOST_PP_VARIADIC_ELEM \
+ ( \
+ 0, \
+ BOOST_PP_IS_SEQ_DETAIL_APPLY(BOOST_PP_IS_SEQ_DETAIL_ASSERT_SIZE_AFTER,x) \
+ ) \
+/**/
+#
 # define BOOST_PP_IS_SEQ_DETAIL_GET_AFTER_FIRST_TUPLE(x) \
     BOOST_PP_IS_SEQ_DETAIL_APPLY(BOOST_PP_IS_SEQ_DETAIL_EMPTY,x) \
 /**/
 #
 # define BOOST_PP_IS_SEQ_DETAIL_GEN_NOT_TUPLE(x) \
- BOOST_PP_ASSERT \
+ BOOST_PP_IS_SEQ_DETAIL_GEN_NOT_TUPLE_GET \
+ ( \
+ BOOST_PP_IS_SEQ_DETAIL_APPLY(BOOST_PP_IS_SEQ_DETAIL_EMPTY,x) \
+ ) \
+/**/
+#
+# define BOOST_PP_IS_SEQ_DETAIL_GEN_NOT_TUPLE_GET(x) \
+ BOOST_PP_IIF \
       ( \
       BOOST_PP_IS_EMPTY \
         ( \
- BOOST_PP_IS_SEQ_DETAIL_APPLY(BOOST_PP_IS_SEQ_DETAIL_EMPTY,x) \
- ) \
+ x \
+ ), \
+ BOOST_PP_IS_SEQ_SUCCESS, \
+ x \
       ) \
 /**/
 #
@@ -116,7 +182,6 @@
 /**/
 #
 # define BOOST_PP_IS_SEQ_DETAIL_IS_AFTER_FIRST_TUPLE(x) \
- BOOST_PP_IS_SEQ_DETAIL_ASSERT_FIRST_TUPLE_SIZE(x) \
     BOOST_PP_IS_TUPLE_BEGIN \
       ( \
       BOOST_PP_IS_SEQ_DETAIL_APPLY(BOOST_PP_IS_SEQ_DETAIL_EMPTY,x) \
@@ -124,21 +189,53 @@
 /**/
 #
 # define BOOST_PP_IS_SEQ_DETAIL_GEN_RETURN_ASSERT(x) \
+ BOOST_PP_IIF \
+ ( \
+ BOOST_PP_IS_SEQ_DETAIL_IS_SUCCESS(x), \
+ BOOST_PP_IS_SEQ_SUCCESS, \
+ BOOST_PP_IS_SEQ_FAILURE \
+ ) \
+/**/
+#
+# define BOOST_PP_IS_SEQ_DETAIL_EMPTY(...)
+#
+# define BOOST_PP_IS_SEQ_DETAIL_EMPTY_F(x) \
     BOOST_PP_ASSERT \
       ( \
- BOOST_PP_IS_EMPTY(x) \
+ BOOST_PP_NOT \
+ ( \
+ BOOST_PP_IS_SEQ_DETAIL_IS_FAILURE(x) \
+ ) \
       ) \
 /**/
 #
-# define BOOST_PP_IS_SEQ_DETAIL_GEN_RETURN_ASSERT_ERROR(x) \
- BOOST_PP_ASSERT(0) \
+# define BOOST_PP_IS_SEQ_DETAIL_IS_SUCCESS(x) \
+ BOOST_PP_IS_EMPTY \
+ ( \
+ BOOST_PP_CAT(BOOST_PP_IS_SEQ_DETAIL_SHELPER_,x) \
+ ) \
 /**/
 #
-# define BOOST_PP_IS_SEQ_DETAIL_EMPTY(...)
+# define BOOST_PP_IS_SEQ_DETAIL_IS_FAILURE(x) \
+ BOOST_PP_IS_EMPTY \
+ ( \
+ BOOST_PP_CAT(BOOST_PP_IS_SEQ_DETAIL_FHELPER_,x) \
+ ) \
+/**/
+#
+# define BOOST_PP_IS_SEQ_DETAIL_SHELPER_BOOST_PP_IS_SEQ_SUCCESS
+#
+# define BOOST_PP_IS_SEQ_DETAIL_FHELPER_BOOST_PP_IS_SEQ_FAILURE
+#
+# define BOOST_PP_IS_SEQ_DETAIL_GEN_ONE(x) 1
+#
+# define BOOST_PP_IS_SEQ_DETAIL_GEN_ZERO(x) 0
+#
+# define BOOST_PP_IS_SEQ_DETAIL_GEN_ONE_COMMA() 1,
 #
-# define BOOST_PP_IS_SEQ_DETAIL_EMPTY_E(x) BOOST_PP_IS_SEQ_DETAIL_EMPTY_E1(x)
+# define BOOST_PP_IS_SEQ_DETAIL_GEN_ZERO_COMMA() 0,
 #
-# define BOOST_PP_IS_SEQ_DETAIL_EMPTY_E1(x)
+# define BOOST_PP_IS_SEQ_DETAIL_GEN_FAILURE(x) BOOST_PP_IS_SEQ_FAILURE
 #
 # endif /* NDEBUG */
 # endif /* BOOST_PP_VARIADICS */

Modified: branches/pplib/v2/libs/preprocessor/test/Jamfile.v2
==============================================================================
--- branches/pplib/v2/libs/preprocessor/test/Jamfile.v2 (original)
+++ branches/pplib/v2/libs/preprocessor/test/Jamfile.v2 2011-07-23 21:42:00 EDT (Sat, 23 Jul 2011)
@@ -21,7 +21,8 @@
         [ compile array.cpp ]
         [ compile comparison.cpp ]
         [ compile control.cpp ]
- [ compile debug.cpp ]
+ [ compile debug.cpp : <variant>debug ]
+# [ compile debug_test.cpp : <variant>debug ]
         [ compile facilities.cpp ]
         [ compile iteration.cpp ]
         [ compile list.cpp ]
@@ -57,104 +58,106 @@
         [ compile-fail debug_fail_tuple.cpp
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cxxflags>-std=c++0x
+ <toolset>gcc:<cxxflags>-std=c++0x
           : debug_fail_tuple_cpp
         ]
         [ compile-fail debug_fail_array.cpp
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cxxflags>-std=c++0x
+ <toolset>gcc:<cxxflags>-std=c++0x
           : debug_fail_array_cpp
         ]
         [ compile-fail debug_fail_list.cpp
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cxxflags>-std=c++0x
+ <toolset>gcc:<cxxflags>-std=c++0x
           : debug_fail_list_cpp
         ]
         [ compile-fail debug_fail_seq.cpp
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cxxflags>-std=c++0x
+ <toolset>gcc:<cxxflags>-std=c++0x
           : debug_fail_seq_cpp
         ]
         [ compile-fail debug_fail_tuple_2.cpp
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cxxflags>-std=c++0x
+ <toolset>gcc:<cxxflags>-std=c++0x
           : debug_fail_tuple_2_cpp
         ]
         [ compile-fail debug_fail_array_2.cpp
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cxxflags>-std=c++0x
+ <toolset>gcc:<cxxflags>-std=c++0x
           : debug_fail_array_2_cpp
         ]
         [ compile-fail debug_fail_list_2.cpp
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cxxflags>-std=c++0x
+ <toolset>gcc:<cxxflags>-std=c++0x
           : debug_fail_list_2_cpp
         ]
         [ compile-fail debug_fail_seq_2.cpp
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cxxflags>-std=c++0x
+ <toolset>gcc:<cxxflags>-std=c++0x
           : debug_fail_seq_2_cpp
         ]
         [ compile-fail debug_fail_tuple_3.cpp
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cxxflags>-std=c++0x
+ <toolset>gcc:<cxxflags>-std=c++0x
           : debug_fail_tuple_3_cpp
         ]
         [ compile-fail debug_fail_array_3.cpp
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cxxflags>-std=c++0x
+ <toolset>gcc:<cxxflags>-std=c++0x
           : debug_fail_array_3_cpp
         ]
         [ compile-fail debug_fail_list_3.cpp
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cxxflags>-std=c++0x
+ <toolset>gcc:<cxxflags>-std=c++0x
           : debug_fail_list_3_cpp
         ]
         [ compile-fail debug_fail_seq_3.cpp
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cxxflags>-std=c++0x
+ <toolset>gcc:<cxxflags>-std=c++0x
           : debug_fail_seq_3_cpp
         ]
         [ compile-fail debug_fail_tuple_4.cpp
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cxxflags>-std=c++0x
+ <toolset>gcc:<cxxflags>-std=c++0x
           : debug_fail_tuple_4_cpp
         ]
         [ compile-fail debug_fail_array_4.cpp
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cxxflags>-std=c++0x
+ <toolset>gcc:<cxxflags>-std=c++0x
           : debug_fail_array_4_cpp
         ]
         [ compile-fail debug_fail_list_4.cpp
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cxxflags>-std=c++0x
+ <toolset>gcc:<cxxflags>-std=c++0x
           : debug_fail_list_4_cpp
         ]
         [ compile-fail debug_fail_seq_4.cpp
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cxxflags>-std=c++0x
+ <toolset>gcc:<cxxflags>-std=c++0x
           : debug_fail_seq_4_cpp
         ]
- :
- <toolset>gcc
    ;
 
-test-suite preprocessor_cpp_dbg ;
+test-suite preprocessor_cpp_dbg
+ :
+ :
+ <toolset>msvc
+ ;
 
 test-suite preprocessor_c
    :
@@ -176,6 +179,7 @@
         ]
         [ compile debug.c
           : <toolset>gcc:<cflags>-std=c99
+ <variant>debug
           : debug_c
         ]
         [ compile facilities.c
@@ -281,101 +285,103 @@
         [ compile-fail debug_fail_tuple.c
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cflags>-std=c99
+ <toolset>gcc:<cflags>-std=c99
           : debug_fail_tuple_c
         ]
         [ compile-fail debug_fail_array.c
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cflags>-std=c99
+ <toolset>gcc:<cflags>-std=c99
           : debug_fail_array_c
         ]
         [ compile-fail debug_fail_list.c
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cflags>-std=c99
+ <toolset>gcc:<cflags>-std=c99
           : debug_fail_list_c
         ]
         [ compile-fail debug_fail_seq.c
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cflags>-std=c99
+ <toolset>gcc:<cflags>-std=c99
           : debug_fail_seq_c
         ]
         [ compile-fail debug_fail_tuple_2.c
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cflags>-std=c99
+ <toolset>gcc:<cflags>-std=c99
           : debug_fail_tuple_2_c
         ]
         [ compile-fail debug_fail_array_2.c
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cflags>-std=c99
+ <toolset>gcc:<cflags>-std=c99
           : debug_fail_array_2_c
         ]
         [ compile-fail debug_fail_list_2.c
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cflags>-std=c99
+ <toolset>gcc:<cflags>-std=c99
           : debug_fail_list_2_c
         ]
         [ compile-fail debug_fail_seq_2.c
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cflags>-std=c99
+ <toolset>gcc:<cflags>-std=c99
           : debug_fail_seq_2_c
         ]
         [ compile-fail debug_fail_tuple_3.c
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cflags>-std=c99
+ <toolset>gcc:<cflags>-std=c99
           : debug_fail_tuple_3_c
         ]
         [ compile-fail debug_fail_array_3.c
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cflags>-std=c99
+ <toolset>gcc:<cflags>-std=c99
           : debug_fail_array_3_c
         ]
         [ compile-fail debug_fail_list_3.c
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cflags>-std=c99
+ <toolset>gcc:<cflags>-std=c99
           : debug_fail_list_3_c
         ]
         [ compile-fail debug_fail_seq_3.c
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cflags>-std=c99
+ <toolset>gcc:<cflags>-std=c99
           : debug_fail_seq_3_c
         ]
         [ compile-fail debug_fail_tuple_4.c
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cflags>-std=c99
+ <toolset>gcc:<cflags>-std=c99
           : debug_fail_tuple_4_c
         ]
         [ compile-fail debug_fail_array_4.c
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cflags>-std=c99
+ <toolset>gcc:<cflags>-std=c99
           : debug_fail_array_4_c
         ]
         [ compile-fail debug_fail_list_4.c
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cflags>-std=c99
+ <toolset>gcc:<cflags>-std=c99
           : debug_fail_list_4_c
         ]
         [ compile-fail debug_fail_seq_4.c
           : <variant>debug
             <define>BOOST_PP_VARIADICS=1
- <cflags>-std=c99
+ <toolset>gcc:<cflags>-std=c99
           : debug_fail_seq_4_c
         ]
- :
- <toolset>gcc
    ;
 
-test-suite preprocessor_c_dbg ;
+test-suite preprocessor_c_dbg
+ :
+ :
+ <toolset>msvc
+ ;

Modified: branches/pplib/v2/libs/preprocessor/test/debug.cxx
==============================================================================
--- branches/pplib/v2/libs/preprocessor/test/debug.cxx (original)
+++ branches/pplib/v2/libs/preprocessor/test/debug.cxx 2011-07-23 21:42:00 EDT (Sat, 23 Jul 2011)
@@ -31,14 +31,14 @@
 BOOST_PP_ASSERT_IS_LIST((4,(x,BOOST_PP_NIL)))
 BOOST_PP_ASSERT_IS_LIST(((3,6m,irj),(x,BOOST_PP_NIL)))
 
-# if !BOOST_PP_VARIADICS_MSVC
+#if !BOOST_PP_VARIADICS_MSVC
 
 BOOST_PP_ASSERT_IS_SEQ((x))
+BOOST_PP_ASSERT_IS_SEQ((x)(y))
 BOOST_PP_ASSERT_IS_SEQ((x)(y)(z)(2)(3)(4))
 BOOST_PP_ASSERT_IS_SEQ((x)(y)(z)((1,2))(3)(4))
 BOOST_PP_ASSERT_IS_SEQ((x)(y)(z)((1,2))(3)((4,(x,BOOST_PP_NIL))))
 BOOST_PP_ASSERT_IS_SEQ((x)(y)((x)(y)(z)(2)(3)(4))((1,2))(3)((4,(x,BOOST_PP_NIL))))
 
 # endif
-
-# endif
\ No newline at end of file
+# endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk