mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 21:07:26 +02:00
committed by
Mohammad Nejati
parent
6adca47bbe
commit
3b837c6982
@ -52,11 +52,8 @@ public:
|
|||||||
|
|
||||||
#if defined(_MSC_VER) && ! defined(__clang__)
|
#if defined(_MSC_VER) && ! defined(__clang__)
|
||||||
# define BOOST_BEAST_UNREACHABLE() __assume(false)
|
# define BOOST_BEAST_UNREACHABLE() __assume(false)
|
||||||
# define BOOST_BEAST_UNREACHABLE_RETURN(v) return v
|
|
||||||
#else
|
#else
|
||||||
# define BOOST_BEAST_UNREACHABLE() __builtin_unreachable()
|
# define BOOST_BEAST_UNREACHABLE() __builtin_unreachable()
|
||||||
# define BOOST_BEAST_UNREACHABLE_RETURN(v) \
|
|
||||||
do { __builtin_unreachable(); return v; } while(false)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BOOST_BEAST_TESTS
|
#ifdef BOOST_BEAST_TESTS
|
||||||
@ -67,6 +64,12 @@ public:
|
|||||||
BOOST_BEAST_UNREACHABLE(); \
|
BOOST_BEAST_UNREACHABLE(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define BOOST_BEAST_LOGIC_ERROR_RETURN(s, v) \
|
||||||
|
{ \
|
||||||
|
BOOST_THROW_EXCEPTION(std::logic_error((s))); \
|
||||||
|
return v; \
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define BOOST_BEAST_LOGIC_ERROR(s) \
|
#define BOOST_BEAST_LOGIC_ERROR(s) \
|
||||||
@ -75,6 +78,12 @@ public:
|
|||||||
BOOST_BEAST_UNREACHABLE(); \
|
BOOST_BEAST_UNREACHABLE(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define BOOST_BEAST_LOGIC_ERROR_RETURN(s, v) \
|
||||||
|
{ \
|
||||||
|
BOOST_ASSERT_MSG(false, s); \
|
||||||
|
return v; \
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
@ -85,11 +94,11 @@ struct buffers_cat_view_iterator_base
|
|||||||
{
|
{
|
||||||
char unused = 0; // make g++8 happy
|
char unused = 0; // make g++8 happy
|
||||||
|
|
||||||
BOOST_NORETURN net::mutable_buffer
|
net::mutable_buffer
|
||||||
operator*() const
|
operator*() const
|
||||||
{
|
{
|
||||||
BOOST_BEAST_LOGIC_ERROR(
|
BOOST_BEAST_LOGIC_ERROR_RETURN(
|
||||||
"Dereferencing a one-past-the-end iterator");
|
"Dereferencing a one-past-the-end iterator", {});
|
||||||
}
|
}
|
||||||
|
|
||||||
operator bool() const noexcept
|
operator bool() const noexcept
|
||||||
@ -173,11 +182,11 @@ private:
|
|||||||
{
|
{
|
||||||
const_iterator const& self;
|
const_iterator const& self;
|
||||||
|
|
||||||
BOOST_NORETURN reference
|
reference
|
||||||
operator()(mp11::mp_size_t<0>)
|
operator()(mp11::mp_size_t<0>)
|
||||||
{
|
{
|
||||||
BOOST_BEAST_LOGIC_ERROR(
|
BOOST_BEAST_LOGIC_ERROR_RETURN(
|
||||||
"Dereferencing a default-constructed iterator");
|
"Dereferencing a default-constructed iterator", {});
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class I>
|
template<class I>
|
||||||
|
Reference in New Issue
Block a user