Support -fno-exceptions

This commit is contained in:
Vinnie Falco
2019-03-01 13:39:12 -08:00
parent 723fceaf67
commit 8c53abe6e5
5 changed files with 24 additions and 31 deletions

View File

@@ -1,3 +1,9 @@
Version 226:
* Support -fno-exceptions
--------------------------------------------------------------------------------
Version 225: Version 225:
* Tidy up an unused function * Tidy up an unused function

View File

@@ -86,8 +86,8 @@ void stream::initiate_read(
++in_->nread; ++in_->nread;
if(in_->op != nullptr) if(in_->op != nullptr)
throw std::logic_error( BOOST_THROW_EXCEPTION(
"in_->op != nullptr"); std::logic_error{"in_->op != nullptr"});
// test failure // test failure
error_code ec; error_code ec;

View File

@@ -674,7 +674,9 @@ struct basic_parser_base
buf.resize(0); buf.resize(0);
buf.append(first, token_last); buf.append(first, token_last);
BOOST_ASSERT(! buf.empty()); BOOST_ASSERT(! buf.empty());
#ifndef BOOST_NO_EXCEPTIONS
try try
#endif
{ {
for(;;) for(;;)
{ {
@@ -719,11 +721,13 @@ struct basic_parser_base
++p; ++p;
} }
} }
#ifndef BOOST_NO_EXCEPTIONS
catch(std::length_error const&) catch(std::length_error const&)
{ {
ec = error::header_limit; ec = error::header_limit;
return; return;
} }
#endif
} }
void void

View File

@@ -1048,6 +1048,7 @@ set_chunked_impl(bool value)
// filter "chunked" // filter "chunked"
if(it == end()) if(it == end())
return; return;
#ifndef BOOST_NO_EXCEPTIONS
try try
{ {
static_string<max_static_buffer> buf; static_string<max_static_buffer> buf;
@@ -1062,6 +1063,7 @@ set_chunked_impl(bool value)
erase(field::transfer_encoding); erase(field::transfer_encoding);
} }
catch(std::length_error const&) catch(std::length_error const&)
#endif
{ {
#ifdef BOOST_BEAST_HTTP_NO_FIELDS_BASIC_STRING_ALLOCATOR #ifdef BOOST_BEAST_HTTP_NO_FIELDS_BASIC_STRING_ALLOCATOR
// Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56437 // Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56437
@@ -1108,6 +1110,7 @@ set_keep_alive_impl(
{ {
// VFALCO What about Proxy-Connection ? // VFALCO What about Proxy-Connection ?
auto const value = (*this)[field::connection]; auto const value = (*this)[field::connection];
#ifndef BOOST_NO_EXCEPTIONS
try try
{ {
static_string<max_static_buffer> buf; static_string<max_static_buffer> buf;
@@ -1119,6 +1122,7 @@ set_keep_alive_impl(
set(field::connection, buf); set(field::connection, buf);
} }
catch(std::length_error const&) catch(std::length_error const&)
#endif
{ {
#ifdef BOOST_BEAST_HTTP_NO_FIELDS_BASIC_STRING_ALLOCATOR #ifdef BOOST_BEAST_HTTP_NO_FIELDS_BASIC_STRING_ALLOCATOR
// Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56437 // Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56437

View File

@@ -350,18 +350,11 @@ private:
} }
used_ = true; used_ = true;
try
{
m_.target(target); m_.target(target);
if(method != verb::unknown) if(method != verb::unknown)
m_.method(method); m_.method(method);
else else
m_.method_string(method_str); m_.method_string(method_str);
}
catch(std::bad_alloc const&)
{
ec = error::bad_alloc;
}
m_.version(version); m_.version(version);
} }
@@ -409,15 +402,8 @@ private:
m_.result(code); m_.result(code);
m_.version(version); m_.version(version);
try
{
m_.reason(reason); m_.reason(reason);
} }
catch(std::bad_alloc const&)
{
ec = error::bad_alloc;
}
}
void void
on_response_impl( on_response_impl(
@@ -443,17 +429,10 @@ private:
field name, field name,
string_view name_string, string_view name_string,
string_view value, string_view value,
error_code& ec) override error_code&) override
{
try
{ {
m_.insert(name, name_string, value); m_.insert(name, name_string, value);
} }
catch(std::bad_alloc const&)
{
ec = error::bad_alloc;
}
}
void void
on_header_impl(error_code& ec) override on_header_impl(error_code& ec) override