Fixes #167 ("error: the address of 'msg' will always evaluate as 'true' warning with GCC 4.4").

This commit is contained in:
Ion Gaztañaga
2020-10-21 22:41:12 +02:00
parent 2198086257
commit 31d7f3875f

View File

@@ -21,6 +21,7 @@
#include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp>
#include <boost/core/ignore_unused.hpp>
#ifndef BOOST_NO_EXCEPTIONS
#include <stdexcept> //for std exception types
@@ -51,41 +52,35 @@ namespace container {
BOOST_NORETURN inline void throw_bad_alloc()
{
const char msg[] = "boost::container bad_alloc thrown";
(void)msg;
BOOST_ASSERT(!msg);
BOOST_ASSERT(!"boost::container bad_alloc thrown");
std::abort();
}
BOOST_NORETURN inline void throw_out_of_range(const char* str)
{
const char msg[] = "boost::container out_of_range thrown";
(void)msg; (void)str;
BOOST_ASSERT_MSG(!msg, str);
boost::ignore_unused(str);
BOOST_ASSERT_MSG(!"boost::container out_of_range thrown", str);
std::abort();
}
BOOST_NORETURN inline void throw_length_error(const char* str)
{
const char msg[] = "boost::container length_error thrown";
(void)msg; (void)str;
BOOST_ASSERT_MSG(!msg, str);
boost::ignore_unused(str);
BOOST_ASSERT_MSG(!"boost::container length_error thrown", str);
std::abort();
}
BOOST_NORETURN inline void throw_logic_error(const char* str)
{
const char msg[] = "boost::container logic_error thrown";
(void)msg; (void)str;
BOOST_ASSERT_MSG(!msg, str);
boost::ignore_unused(str);
BOOST_ASSERT_MSG(!"boost::container logic_error thrown", str);
std::abort();
}
BOOST_NORETURN inline void throw_runtime_error(const char* str)
{
const char msg[] = "boost::container runtime_error thrown";
(void)msg; (void)str;
BOOST_ASSERT_MSG(!msg, str);
boost::ignore_unused(str);
BOOST_ASSERT_MSG(!"boost::container runtime_error thrown", str);
std::abort();
}