Silence msvc compiler warnings about constant conditional expressions, returning the adress of local variables, and unused formal parameters.

Signed-off-by: Daniela Engert <dani@ngrt.de>
This commit is contained in:
Daniela Engert
2015-04-11 10:30:12 +02:00
parent d393d391b8
commit 6c2c2fd506
5 changed files with 37 additions and 4 deletions
@@ -25,6 +25,11 @@
#include <tuple>
#ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable: 4100) // unreferenced formal parameter
#endif
namespace boost {
namespace detail { namespace variant {
@@ -179,5 +184,9 @@ namespace detail { namespace variant {
} // namespace boost
#ifdef BOOST_MSVC
# pragma warning(pop)
#endif
#endif // BOOST_VARIANT_DETAIL_MULTIVISITORS_CPP11_BASED_HPP
+11
View File
@@ -173,6 +173,12 @@ relaxed_get(
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#if defined(BOOST_MSVC)
# pragma warning(push)
# pragma warning(disable: 4172) // returning address of local variable or temporary
#endif
template <typename U, BOOST_VARIANT_ENUM_PARAMS(typename T) >
inline
U&&
@@ -188,6 +194,11 @@ relaxed_get(
boost::throw_exception(bad_get());
return static_cast<U&&>(*result);
}
#if defined(BOOST_MSVC)
# pragma warning(pop)
#endif
#endif
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
+9
View File
@@ -112,6 +112,11 @@
#endif
#if defined(BOOST_MSVC)
# pragma warning(push)
# pragma warning(disable: 4127) // conditional expression is constant
#endif
namespace boost {
namespace detail { namespace variant {
@@ -2484,4 +2489,8 @@ inline void swap(
#include <boost/variant/detail/variant_io.hpp>
#endif // BOOST_NO_IOSTREAM
#if defined(BOOST_MSVC)
# pragma warning(pop)
#endif
#endif // BOOST_VARIANT_VARIANT_HPP
+1 -1
View File
@@ -36,7 +36,7 @@ using set_t = basic_set_t<value_t>;
struct hash
{
size_t operator()(const value_t& value) const
size_t operator()(const value_t&) const
{
return 0;
}
+7 -3
View File
@@ -9,6 +9,10 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifdef _MSC_VER
#pragma warning(disable: 4127) // conditional expression is constant
#endif
#include "boost/variant/get.hpp"
#include "boost/variant/variant.hpp"
#include "boost/variant/polymorphic_get.hpp"
@@ -362,12 +366,12 @@ public:
MoveonlyType() {}
~MoveonlyType() {}
MoveonlyType(MoveonlyType&& other) {}
void operator=(MoveonlyType&& other) {}
MoveonlyType(MoveonlyType&&) {}
void operator=(MoveonlyType&&) {}
private:
MoveonlyType(const MoveonlyType&);
void operator=(const MoveonlyType& other);
void operator=(const MoveonlyType&);
};
const boost::variant<int, std::string> foo1() { return ""; }