Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80368 - trunk/boost/fusion/adapted/struct/detail
From: joel_at_[hidden]
Date: 2012-09-03 03:08:48


Author: djowel
Date: 2012-09-03 03:08:47 EDT (Mon, 03 Sep 2012)
New Revision: 80368
URL: http://svn.boost.org/trac/boost/changeset/80368

Log:
Fix to silence MSVC warnings (Nathan Ridge)
Text files modified:
   trunk/boost/fusion/adapted/struct/detail/define_struct_inline.hpp | 6 +++++-
   1 files changed, 5 insertions(+), 1 deletions(-)

Modified: trunk/boost/fusion/adapted/struct/detail/define_struct_inline.hpp
==============================================================================
--- trunk/boost/fusion/adapted/struct/detail/define_struct_inline.hpp (original)
+++ trunk/boost/fusion/adapted/struct/detail/define_struct_inline.hpp 2012-09-03 03:08:47 EDT (Mon, 03 Sep 2012)
@@ -20,6 +20,7 @@
 #include <boost/mpl/if.hpp>
 #include <boost/type_traits/is_const.hpp>
 #include <boost/preprocessor/comma_if.hpp>
+#include <boost/preprocessor/facilities/is_empty.hpp>
 #include <boost/preprocessor/repeat.hpp>
 #include <boost/preprocessor/seq/for_each_i.hpp>
 #include <boost/preprocessor/seq/size.hpp>
@@ -184,11 +185,14 @@
         NAME, \
         BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0 ATTRIBUTES,_END))
 
+// Note: can't compute BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ) directly because
+// ATTRIBUTES_SEQ may be empty and calling BOOST_PP_SEQ_SIZE on an empty
+// sequence produces warnings on MSVC.
 #define BOOST_FUSION_DEFINE_STRUCT_MEMBERS_IMPL(NAME, ATTRIBUTES_SEQ) \
     BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS_IMPL_IMPL( \
         NAME, \
         ATTRIBUTES_SEQ, \
- BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ))
+ BOOST_PP_DEC(BOOST_PP_SEQ_SIZE((0)ATTRIBUTES_SEQ)))
 
 #define BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR(NAME, ATTRIBUTES) \
     BOOST_FUSION_DEFINE_STRUCT_ITERATOR_IMPL( \


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