|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r73821 - in sandbox/variadic_macro_data: boost/variadic_macro_data boost/variadic_macro_data/detail libs/variadic_macro_data/doc libs/variadic_macro_data/test
From: eldiener_at_[hidden]
Date: 2011-08-16 15:50:09
Author: eldiener
Date: 2011-08-16 15:50:08 EDT (Tue, 16 Aug 2011)
New Revision: 73821
URL: http://svn.boost.org/trac/boost/changeset/73821
Log:
Changes to is_begin_parens and is_empty.
Text files modified:
sandbox/variadic_macro_data/boost/variadic_macro_data/detail/vmd_detail_is_begin_parens.hpp | 21 ++++++++++++++++-----
sandbox/variadic_macro_data/boost/variadic_macro_data/detail/vmd_detail_is_empty.hpp | 12 ------------
sandbox/variadic_macro_data/boost/variadic_macro_data/vmd_is_begin_parens.hpp | 26 +++-----------------------
sandbox/variadic_macro_data/boost/variadic_macro_data/vmd_is_empty.hpp | 31 +++++++++----------------------
sandbox/variadic_macro_data/libs/variadic_macro_data/doc/vmd_detail.qbk | 16 ++++++++++------
sandbox/variadic_macro_data/libs/variadic_macro_data/test/test_is_empty.cpp | 14 ++++++++++++--
6 files changed, 50 insertions(+), 70 deletions(-)
Modified: sandbox/variadic_macro_data/boost/variadic_macro_data/detail/vmd_detail_is_begin_parens.hpp
==============================================================================
--- sandbox/variadic_macro_data/boost/variadic_macro_data/detail/vmd_detail_is_begin_parens.hpp (original)
+++ sandbox/variadic_macro_data/boost/variadic_macro_data/detail/vmd_detail_is_begin_parens.hpp 2011-08-16 15:50:08 EDT (Tue, 16 Aug 2011)
@@ -3,11 +3,11 @@
#include <boost/variadic_macro_data/detail/vmd_detail_setup.hpp>
-#if BOOST_VMD_VARIADICS && BOOST_VMD_MSVC
+#if BOOST_VMD_VARIADICS
-#include <boost/preprocessor/facilities/empty.hpp>
+#if BOOST_VMD_MSVC
-#define VMD_DETAIL_IS_TUPLE_BEGIN_COMMON_EXPAND(...) 1,1
+#include <boost/preprocessor/facilities/empty.hpp>
#define VMD_DETAIL_VD_IS_BEGIN_PARENS_CAT(a, b) VMD_DETAIL_VD_IS_BEGIN_PARENS_CAT_I(a, b)
#define VMD_DETAIL_VD_IS_BEGIN_PARENS_CAT_I(a, b) VMD_DETAIL_VD_IS_BEGIN_PARENS_CAT_II(a ## b)
@@ -17,15 +17,26 @@
VMD_DETAIL_VD_IS_BEGIN_PARENS_CAT(VMD_DETAIL_IS_BEGIN_PARENS_PRIMITIVE_CAT(VMD_DETAIL_IS_BEGIN_PARENS_SPLIT_,i)(__VA_ARGS__),BOOST_PP_EMPTY()) \
/**/
+#define VMD_DETAIL_IS_BEGIN_PARENS_IS_VARIADIC_C(...) 1 1
+
+#else
+
+#define VMD_DETAIL_IS_BEGIN_PARENS_SPLIT(i, ...) \
+ VMD_DETAIL_IS_BEGIN_PARENS_PRIMITIVE_CAT(VMD_DETAIL_IS_BEGIN_PARENS_SPLIT_,i)(__VA_ARGS__) \
+/**/
+
+#define VMD_DETAIL_IS_BEGIN_PARENS_IS_VARIADIC_C(...) 1
+
+#endif /* BOOST_VMD_MSVC */
+
#define VMD_DETAIL_IS_BEGIN_PARENS_SPLIT_0(a, ...) a
#define VMD_DETAIL_IS_BEGIN_PARENS_SPLIT_1(a, ...) __VA_ARGS__
#define VMD_DETAIL_IS_BEGIN_PARENS_CAT(a, ...) VMD_DETAIL_IS_BEGIN_PARENS_PRIMITIVE_CAT(a,__VA_ARGS__)
#define VMD_DETAIL_IS_BEGIN_PARENS_PRIMITIVE_CAT(a, ...) a ## __VA_ARGS__
-#define VMD_DETAIL_IS_BEGIN_PARENS_IS_VARIADIC_C(...) 1 1
#define VMD_DETAIL_IS_BEGIN_PARENS_IS_VARIADIC_R_1 1,
#define VMD_DETAIL_IS_BEGIN_PARENS_IS_VARIADIC_R_VMD_DETAIL_IS_BEGIN_PARENS_IS_VARIADIC_C 0,
-#endif /* BOOST_VMD_VARIADICS && BOOST_VMD_MSVC */
+#endif /* BOOST_VMD_VARIADICS */
#endif /* VMD_DETAIL_IS_TUPLE_BEGIN_HPP */
Modified: sandbox/variadic_macro_data/boost/variadic_macro_data/detail/vmd_detail_is_empty.hpp
==============================================================================
--- sandbox/variadic_macro_data/boost/variadic_macro_data/detail/vmd_detail_is_empty.hpp (original)
+++ sandbox/variadic_macro_data/boost/variadic_macro_data/detail/vmd_detail_is_empty.hpp 2011-08-16 15:50:08 EDT (Tue, 16 Aug 2011)
@@ -12,24 +12,12 @@
#define VMD_DETAIL_IS_EMPTY_PRIMITIVE_CAT(a, b) a ## b
#define VMD_DETAIL_IS_EMPTY_IIF_0(t, b) b
#define VMD_DETAIL_IS_EMPTY_IIF_1(t, b) t
-#define VMD_DETAIL_IS_EMPTY_GEN_ZERO(x) 0
#else
#define VMD_DETAIL_IS_EMPTY_PRIMITIVE_CAT(a, ...) a ## __VA_ARGS__
-#define VMD_DETAIL_IS_EMPTY_CAT(a, ...) VMD_DETAIL_IS_EMPTY_PRIMITIVE_CAT(a,__VA_ARGS__)
#define VMD_DETAIL_IS_EMPTY_IIF_0(t, ...) __VA_ARGS__
#define VMD_DETAIL_IS_EMPTY_IIF_1(t, ...) t
-#define VMD_DETAIL_IS_EMPTY_SPLIT(i, ...) \
- VMD_DETAIL_IS_EMPTY_PRIMITIVE_CAT(VMD_DETAIL_IS_EMPTY_SPLIT_,i)(__VA_ARGS__) \
-/**/
-
-#define VMD_DETAIL_IS_EMPTY_SPLIT_0(a, ...) a
-#define VMD_DETAIL_IS_EMPTY_SPLIT_1(a, ...) __VA_ARGS__
-
-#define VMD_DETAIL_IS_EMPTY_IS_VARIADIC_C(...) 1
-#define VMD_DETAIL_IS_EMPTY_IS_VARIADIC_R_1 1,
-#define VMD_DETAIL_IS_EMPTY_IS_VARIADIC_R_VMD_DETAIL_IS_EMPTY_IS_VARIADIC_C 0,
#endif /* BOOST_VMD_MSVC */
Modified: sandbox/variadic_macro_data/boost/variadic_macro_data/vmd_is_begin_parens.hpp
==============================================================================
--- sandbox/variadic_macro_data/boost/variadic_macro_data/vmd_is_begin_parens.hpp (original)
+++ sandbox/variadic_macro_data/boost/variadic_macro_data/vmd_is_begin_parens.hpp 2011-08-16 15:50:08 EDT (Tue, 16 Aug 2011)
@@ -5,6 +5,8 @@
#if BOOST_VMD_VARIADICS
+#include <boost/variadic_macro_data/detail/vmd_detail_is_begin_parens.hpp>
+
/*
The succeeding comments in this file are in doxygen format.
@@ -43,10 +45,6 @@
*/
-#if BOOST_VMD_MSVC
-
-#include <boost/variadic_macro_data/detail/vmd_detail_is_begin_parens.hpp>
-
#if BOOST_VMD_MSVC_V8
#define BOOST_VMD_IS_BEGIN_PARENS(param) \
@@ -76,23 +74,5 @@
/**/
#endif /* BOOST_VMD_MSVC_V8 */
-
-#else
-
-#include <boost/variadic_macro_data/detail/vmd_detail_is_empty.hpp>
-
-#define BOOST_VMD_IS_BEGIN_PARENS(...) \
- VMD_DETAIL_IS_EMPTY_SPLIT \
- ( \
- 0, \
- VMD_DETAIL_IS_EMPTY_CAT \
- ( \
- VMD_DETAIL_IS_EMPTY_IS_VARIADIC_R_, \
- VMD_DETAIL_IS_EMPTY_IS_VARIADIC_C __VA_ARGS__ \
- ) \
- ) \
-/**/
-
-#endif /* BOOST_VMD_MSVC */
-#endif /* BOOST_VMD_VARIADICS && !BOOST_VMD_MSVC */
+#endif /* BOOST_VMD_VARIADICS */
#endif /* VMD_IS_TUPLE_BEGIN_HPP */
Modified: sandbox/variadic_macro_data/boost/variadic_macro_data/vmd_is_empty.hpp
==============================================================================
--- sandbox/variadic_macro_data/boost/variadic_macro_data/vmd_is_empty.hpp (original)
+++ sandbox/variadic_macro_data/boost/variadic_macro_data/vmd_is_empty.hpp 2011-08-16 15:50:08 EDT (Tue, 16 Aug 2011)
@@ -48,38 +48,25 @@
*/
-#if BOOST_VMD_MSVC
-
#if BOOST_VMD_MSVC_V8
#define BOOST_VMD_IS_EMPTY(param) \
VMD_DETAIL_IS_EMPTY_IIF \
( \
- BOOST_VMD_IS_BEGIN_PARENS(param) \
- ) \
- ( \
- VMD_DETAIL_IS_EMPTY_GEN_ZERO, \
BOOST_VMD_IS_BEGIN_PARENS \
- ) \
- (VMD_DETAIL_IS_EMPTY_NON_FUNCTION_C param ()) \
-/**/
-
-#else
-
-#define BOOST_VMD_IS_EMPTY(...) \
- VMD_DETAIL_IS_EMPTY_IIF \
- ( \
- BOOST_VMD_IS_BEGIN_PARENS(__VA_ARGS__) \
+ ( \
+ param \
+ ) \
) \
( \
- VMD_DETAIL_IS_EMPTY_GEN_ZERO, \
+ 0, \
BOOST_VMD_IS_BEGIN_PARENS \
+ ( \
+ VMD_DETAIL_IS_EMPTY_NON_FUNCTION_C param () \
+ ) \
) \
- (VMD_DETAIL_IS_EMPTY_NON_FUNCTION_C __VA_ARGS__ ()) \
/**/
-#endif /* BOOST_VMD_MSVC_V8 */
-
#else
#define BOOST_VMD_IS_EMPTY(...) \
@@ -99,6 +86,6 @@
) \
/**/
-#endif /* BOOST_VMD_MSVC */
-#endif /* BOOST_VMD_VARIADICS && !BOOST_VMD_MSVC */
+#endif /* BOOST_VMD_MSVC_V8 */
+#endif /* BOOST_VMD_VARIADICS */
#endif /* VMD_IS_EMPTY_HPP */
Modified: sandbox/variadic_macro_data/libs/variadic_macro_data/doc/vmd_detail.qbk
==============================================================================
--- sandbox/variadic_macro_data/libs/variadic_macro_data/doc/vmd_detail.qbk (original)
+++ sandbox/variadic_macro_data/libs/variadic_macro_data/doc/vmd_detail.qbk 2011-08-16 15:50:08 EDT (Tue, 16 Aug 2011)
@@ -420,8 +420,12 @@
[footnote For VC++ 8 the input is not variadic data but a single parameter].
The one situation where the macro may not work properly is if its
-input is a function-like macro name. In that case the macro may
-either work incorrectly or give a compiler error.
+input is a function-like macro name. Here are the problems that can occur
+in this case:
+
+# If the function-like macro has one or more parameters: a compiler error should occur.
+# If the function-like macro has no parameters but outputs a Boost PP tuple with one or more elements: a compiler error should occur.
+# If the function-like macro has no parameters but outputs a set of empty parameters when using VC++: an incorrect result will occur. This is because of a bug in the VC++ preprocessor.
The end-user of VMD can include the individual header file 'vmd_is_empty.hpp'
instead of the general header file 'vmd.hpp' for using this macro.
@@ -497,10 +501,10 @@
that its 'param' is not the Boost PP data type being checked. Still there is the
very slight flaw in the assert macros where its reliance on BOOST_VMD_IS_EMPTY
could run into input being checked where a function-like macro name will produce
-the incorrect result from the BOOST_VMD_IS_EMPTY macro. However this flaw is thought to be
-so slight, and an end-user's chance of inputting such data so minimal, that it
-was felt that such assert-like macros would be beneficial to macro programmers
-using Boost PP and VMD.
+the incorrect result from the BOOST_VMD_IS_EMPTY macro when using VC++.
+However this flaw is thought to be so slight, and an end-user's chance of inputting
+such data so minimal, that it was felt that such assert-like macros would be
+beneficial to macro programmers using Boost PP and VMD.
Another point to be made is that Boost PP array and list are also tuples. So
passing an array or list to BOOST_VMD_ASSERT_IS_TUPLE will assert that either one of those Boost PP data types
Modified: sandbox/variadic_macro_data/libs/variadic_macro_data/test/test_is_empty.cpp
==============================================================================
--- sandbox/variadic_macro_data/libs/variadic_macro_data/test/test_is_empty.cpp (original)
+++ sandbox/variadic_macro_data/libs/variadic_macro_data/test/test_is_empty.cpp 2011-08-16 15:50:08 EDT (Tue, 16 Aug 2011)
@@ -24,9 +24,19 @@
BOOST_TEST(BOOST_VMD_IS_EMPTY(OBJECT BOOST_PP_EMPTY()));
BOOST_TEST(BOOST_VMD_IS_EMPTY(FUNC(z) BOOST_PP_EMPTY()));
-// BOOST_TEST(BOOST_VMD_IS_EMPTY(FUNC_GEN));
+#if BOOST_VMD_MSVC
-#endif
+ /* This shows that VC++ does not work correctly in this case. */
+
+ BOOST_TEST(BOOST_VMD_IS_EMPTY(FUNC_GEN));
+
+#else
+
+ BOOST_TEST(!BOOST_VMD_IS_EMPTY(FUNC_GEN));
+
+#endif /* BOOST_VMD_MSVC */
+
+#endif /* BOOST_VMD_VARIADICS */
return boost::report_errors();
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