From 520dd7cbddfa26245edea719d52161e14e41fa95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sun, 1 Oct 2017 00:54:51 +0200 Subject: [PATCH] Try to fix [boostorg/container] unused parameter warning when compiling with assertions disabled (#56) --- include/boost/container/throw_exception.hpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/include/boost/container/throw_exception.hpp b/include/boost/container/throw_exception.hpp index 118cc39..5922fa5 100644 --- a/include/boost/container/throw_exception.hpp +++ b/include/boost/container/throw_exception.hpp @@ -51,31 +51,41 @@ namespace container { inline void throw_bad_alloc() { - BOOST_ASSERT(!"boost::container bad_alloc thrown"); + const char msg[] = "boost::container bad_alloc thrown"; + (void)msg; + BOOST_ASSERT(!msg); std::abort(); } inline void throw_out_of_range(const char* str) { - BOOST_ASSERT_MSG(!"boost::container out_of_range thrown", str); + const char msg[] = "boost::container out_of_range thrown"; + (void)msg; + BOOST_ASSERT_MSG(!msg, str); std::abort(); } inline void throw_length_error(const char* str) { - BOOST_ASSERT_MSG(!"boost::container length_error thrown", str); + const char msg[] = "boost::container length_error thrown"; + (void)msg; + BOOST_ASSERT_MSG(!msg, str); std::abort(); } inline void throw_logic_error(const char* str) { - BOOST_ASSERT_MSG(!"boost::container logic_error thrown", str); + const char msg[] = "boost::container logic_error thrown"; + (void)msg; + BOOST_ASSERT_MSG(!msg, str); std::abort(); } inline void throw_runtime_error(const char* str) { - BOOST_ASSERT_MSG(!"boost::container runtime_error thrown", str); + const char msg[] = "boost::container runtime_error thrown"; + (void)msg; + BOOST_ASSERT_MSG(!msg, str); std::abort(); }