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:
* Tidy up an unused function

View File

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

View File

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

View File

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

View File

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