Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2008-03-07 12:46:38


Author: eric_niebler
Date: 2008-03-07 12:46:38 EST (Fri, 07 Mar 2008)
New Revision: 43538
URL: http://svn.boost.org/trac/boost/changeset/43538

Log:
use a __pragma to disable a msvc warning, fixes #1672
Text files modified:
   trunk/boost/foreach.hpp | 12 ++++++++++--
   1 files changed, 10 insertions(+), 2 deletions(-)

Modified: trunk/boost/foreach.hpp
==============================================================================
--- trunk/boost/foreach.hpp (original)
+++ trunk/boost/foreach.hpp 2008-03-07 12:46:38 EST (Fri, 07 Mar 2008)
@@ -860,6 +860,13 @@
 } // namespace foreach_detail_
 } // namespace boost
 
+// Suppress a bogus code analysis warning on vc8+
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+# define BOOST_FOREACH_SUPPRESS_WARNINGS() __pragma(warning(suppress:6001))
+#else
+# define BOOST_FOREACH_SUPPRESS_WARNINGS()
+#endif
+
 // A sneaky way to get the type of the collection without evaluating the expression
 #define BOOST_FOREACH_TYPEOF(COL) \
     (true ? 0 : boost::foreach_detail_::encode_type(COL, boost::foreach_detail_::is_const_(COL)))
@@ -885,7 +892,7 @@
 
 // No variable is needed to track the rvalue-ness of the collection expression
 # define BOOST_FOREACH_PREAMBLE() \
- /**/
+ BOOST_FOREACH_SUPPRESS_WARNINGS()
 
 // Evaluate the collection expression
 # define BOOST_FOREACH_EVALUATE(COL) \
@@ -903,6 +910,7 @@
 
 // Declare a variable to track the rvalue-ness of the collection expression
 # define BOOST_FOREACH_PREAMBLE() \
+ BOOST_FOREACH_SUPPRESS_WARNINGS() \
     if (bool _foreach_is_rvalue = false) {} else
 
 // Evaluate the collection expression, and detect if it is an lvalue or and rvalue
@@ -928,7 +936,7 @@
 
 // No variable is needed to track the rvalue-ness of the collection expression
 # define BOOST_FOREACH_PREAMBLE() \
- /**/
+ BOOST_FOREACH_SUPPRESS_WARNINGS()
 
 // Evaluate the collection expression
 # define BOOST_FOREACH_EVALUATE(COL) \


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