|
Boost-Commit : |
From: david_at_[hidden]
Date: 2007-12-06 01:23:56
Author: djenkins
Date: 2007-12-06 01:23:55 EST (Thu, 06 Dec 2007)
New Revision: 41775
URL: http://svn.boost.org/trac/boost/changeset/41775
Log:
Avoid bug in Microsoft Code Analysis
Text files modified:
trunk/boost/foreach.hpp | 3 ++-
trunk/libs/foreach/test/rvalue_const.cpp | 3 +++
2 files changed, 5 insertions(+), 1 deletions(-)
Modified: trunk/boost/foreach.hpp
==============================================================================
--- trunk/boost/foreach.hpp (original)
+++ trunk/boost/foreach.hpp 2007-12-06 01:23:55 EST (Thu, 06 Dec 2007)
@@ -14,6 +14,7 @@
// Russell Hind - For help porting to Borland
// Alisdair Meredith - For help porting to Borland
// Stefan Slapeta - For help porting to Intel
+// David Jenkins - For help finding a Microsoft Code Analysis bug
#ifndef BOOST_FOREACH
@@ -29,7 +30,7 @@
#include <boost/detail/workaround.hpp>
// Some compilers let us detect even const-qualified rvalues at compile-time
-#if BOOST_WORKAROUND(BOOST_MSVC, >= 1310) \
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1310) && !defined(_PREFAST_) \
|| (BOOST_WORKAROUND(__GNUC__, >= 4) && !defined(BOOST_INTEL)) \
|| (BOOST_WORKAROUND(__GNUC__, == 3) && (__GNUC_MINOR__ >= 4) && !defined(BOOST_INTEL))
# define BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION
Modified: trunk/libs/foreach/test/rvalue_const.cpp
==============================================================================
--- trunk/libs/foreach/test/rvalue_const.cpp (original)
+++ trunk/libs/foreach/test/rvalue_const.cpp 2007-12-06 01:23:55 EST (Thu, 06 Dec 2007)
@@ -13,7 +13,10 @@
#include <boost/foreach.hpp>
#ifdef BOOST_FOREACH_NO_CONST_RVALUE_DETECTION
+// ignore error during Microsoft Code Analysis
+#if !defined(_PREFAST_)
# error Expected failure : const rvalues disallowed
+#endif
#else
std::vector<int> const get_vector()
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