mirror of
https://github.com/boostorg/beast.git
synced 2025-08-01 05:44:38 +02:00
Fix unused variable warnings
This commit is contained in:
@@ -950,6 +950,7 @@ void custom_parser<isRequest>::
|
|||||||
on_request(verb method, string_view method_str,
|
on_request(verb method, string_view method_str,
|
||||||
string_view path, int version, error_code& ec)
|
string_view path, int version, error_code& ec)
|
||||||
{
|
{
|
||||||
|
boost::ignore_unused(method, method_str, path, version);
|
||||||
ec = {};
|
ec = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -958,6 +959,7 @@ void custom_parser<isRequest>::
|
|||||||
on_response(int status, string_view reason,
|
on_response(int status, string_view reason,
|
||||||
int version, error_code& ec)
|
int version, error_code& ec)
|
||||||
{
|
{
|
||||||
|
boost::ignore_unused(status, reason, version);
|
||||||
ec = {};
|
ec = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -966,6 +968,7 @@ void custom_parser<isRequest>::
|
|||||||
on_field(field f, string_view name,
|
on_field(field f, string_view name,
|
||||||
string_view value, error_code& ec)
|
string_view value, error_code& ec)
|
||||||
{
|
{
|
||||||
|
boost::ignore_unused(f, name, value);
|
||||||
ec = {};
|
ec = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -981,6 +984,7 @@ void custom_parser<isRequest>::
|
|||||||
on_body(boost::optional<std::uint64_t> const& content_length,
|
on_body(boost::optional<std::uint64_t> const& content_length,
|
||||||
error_code& ec)
|
error_code& ec)
|
||||||
{
|
{
|
||||||
|
boost::ignore_unused(content_length);
|
||||||
ec = {};
|
ec = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -988,6 +992,7 @@ template<bool isRequest>
|
|||||||
void custom_parser<isRequest>::
|
void custom_parser<isRequest>::
|
||||||
on_data(string_view s, error_code& ec)
|
on_data(string_view s, error_code& ec)
|
||||||
{
|
{
|
||||||
|
boost::ignore_unused(s);
|
||||||
ec = {};
|
ec = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -996,6 +1001,7 @@ void custom_parser<isRequest>::
|
|||||||
on_chunk(std::uint64_t size,
|
on_chunk(std::uint64_t size,
|
||||||
string_view extension, error_code& ec)
|
string_view extension, error_code& ec)
|
||||||
{
|
{
|
||||||
|
boost::ignore_unused(size, extension);
|
||||||
ec = {};
|
ec = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
#include <beast/core.hpp>
|
#include <beast/core.hpp>
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
@@ -328,7 +329,7 @@ async_echo(AsyncStream& stream, CompletionToken&& token)
|
|||||||
|
|
||||||
//]
|
//]
|
||||||
|
|
||||||
int main()
|
int main(int, char** argv)
|
||||||
{
|
{
|
||||||
using address_type = boost::asio::ip::address;
|
using address_type = boost::asio::ip::address;
|
||||||
using socket_type = boost::asio::ip::tcp::socket;
|
using socket_type = boost::asio::ip::tcp::socket;
|
||||||
@@ -347,6 +348,8 @@ int main()
|
|||||||
async_echo(sock,
|
async_echo(sock,
|
||||||
[&](beast::error_code ec)
|
[&](beast::error_code ec)
|
||||||
{
|
{
|
||||||
|
if(ec)
|
||||||
|
std::cerr << argv[0] << ": " << ec.message() << std::endl;
|
||||||
});
|
});
|
||||||
ios.run();
|
ios.run();
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -346,6 +346,8 @@ void
|
|||||||
file_body::writer::
|
file_body::writer::
|
||||||
init(boost::optional<std::uint64_t> const& content_length, beast::error_code& ec)
|
init(boost::optional<std::uint64_t> const& content_length, beast::error_code& ec)
|
||||||
{
|
{
|
||||||
|
boost::ignore_unused(content_length);
|
||||||
|
|
||||||
// Attempt to open the file for writing
|
// Attempt to open the file for writing
|
||||||
file_ = fopen(path_.string().c_str(), "wb");
|
file_ = fopen(path_.string().c_str(), "wb");
|
||||||
|
|
||||||
|
@@ -111,6 +111,8 @@ public:
|
|||||||
beast::http::request<Body, Fields>&& req,
|
beast::http::request<Body, Fields>&& req,
|
||||||
Send const& send) const
|
Send const& send) const
|
||||||
{
|
{
|
||||||
|
boost::ignore_unused(ep);
|
||||||
|
|
||||||
// Determine our action based on the method
|
// Determine our action based on the method
|
||||||
switch(req.method())
|
switch(req.method())
|
||||||
{
|
{
|
||||||
@@ -219,6 +221,7 @@ private:
|
|||||||
beast::http::request<Body, Fields> const& req,
|
beast::http::request<Body, Fields> const& req,
|
||||||
boost::filesystem::path const& rel_path) const
|
boost::filesystem::path const& rel_path) const
|
||||||
{
|
{
|
||||||
|
boost::ignore_unused(rel_path);
|
||||||
beast::http::response<beast::http::string_body> res;
|
beast::http::response<beast::http::string_body> res;
|
||||||
res.version = req.version;
|
res.version = req.version;
|
||||||
res.result(beast::http::status::not_found);
|
res.result(beast::http::status::not_found);
|
||||||
|
@@ -119,7 +119,7 @@ ssl_certificate::construct()
|
|||||||
"-----END DH PARAMETERS-----\n";
|
"-----END DH PARAMETERS-----\n";
|
||||||
|
|
||||||
ctx_.set_password_callback(
|
ctx_.set_password_callback(
|
||||||
[](std::size_t size,
|
[](std::size_t,
|
||||||
boost::asio::ssl::context_base::password_purpose)
|
boost::asio::ssl::context_base::password_purpose)
|
||||||
{
|
{
|
||||||
return "test";
|
return "test";
|
||||||
|
@@ -57,6 +57,7 @@ class write_msg_op
|
|||||||
: stream(stream_)
|
: stream(stream_)
|
||||||
, msg(std::move(msg_))
|
, msg(std::move(msg_))
|
||||||
{
|
{
|
||||||
|
boost::ignore_unused(handler);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -148,7 +148,7 @@ public:
|
|||||||
friend
|
friend
|
||||||
void
|
void
|
||||||
teardown(websocket::teardown_tag,
|
teardown(websocket::teardown_tag,
|
||||||
string_iostream& stream,
|
string_iostream&,
|
||||||
boost::system::error_code& ec)
|
boost::system::error_code& ec)
|
||||||
{
|
{
|
||||||
ec.assign(0, ec.category());
|
ec.assign(0, ec.category());
|
||||||
|
@@ -136,7 +136,7 @@ public:
|
|||||||
friend
|
friend
|
||||||
void
|
void
|
||||||
teardown(websocket::teardown_tag,
|
teardown(websocket::teardown_tag,
|
||||||
string_istream& stream,
|
string_istream&,
|
||||||
boost::system::error_code& ec)
|
boost::system::error_code& ec)
|
||||||
{
|
{
|
||||||
ec.assign(0, ec.category());
|
ec.assign(0, ec.category());
|
||||||
|
@@ -57,7 +57,7 @@ public:
|
|||||||
|
|
||||||
template<class MutableBufferSequence>
|
template<class MutableBufferSequence>
|
||||||
std::size_t
|
std::size_t
|
||||||
read_some(MutableBufferSequence const& buffers,
|
read_some(MutableBufferSequence const&,
|
||||||
error_code& ec)
|
error_code& ec)
|
||||||
{
|
{
|
||||||
ec = boost::asio::error::eof;
|
ec = boost::asio::error::eof;
|
||||||
@@ -67,7 +67,7 @@ public:
|
|||||||
template<class MutableBufferSequence, class ReadHandler>
|
template<class MutableBufferSequence, class ReadHandler>
|
||||||
async_return_type<
|
async_return_type<
|
||||||
ReadHandler, void(error_code, std::size_t)>
|
ReadHandler, void(error_code, std::size_t)>
|
||||||
async_read_some(MutableBufferSequence const& buffers,
|
async_read_some(MutableBufferSequence const&,
|
||||||
ReadHandler&& handler)
|
ReadHandler&& handler)
|
||||||
{
|
{
|
||||||
async_completion<ReadHandler,
|
async_completion<ReadHandler,
|
||||||
@@ -124,7 +124,7 @@ public:
|
|||||||
friend
|
friend
|
||||||
void
|
void
|
||||||
teardown(websocket::teardown_tag,
|
teardown(websocket::teardown_tag,
|
||||||
string_ostream& stream,
|
string_ostream&,
|
||||||
boost::system::error_code& ec)
|
boost::system::error_code& ec)
|
||||||
{
|
{
|
||||||
ec.assign(0, ec.category());
|
ec.assign(0, ec.category());
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
#ifndef BEAST_CONFIG_HPP
|
#ifndef BEAST_CONFIG_HPP
|
||||||
#define BEAST_CONFIG_HPP
|
#define BEAST_CONFIG_HPP
|
||||||
|
|
||||||
|
#include <boost/core/ignore_unused.hpp>
|
||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -62,19 +62,6 @@ inline
|
|||||||
void
|
void
|
||||||
accept_rv(T){}
|
accept_rv(T){}
|
||||||
|
|
||||||
template<class... Ts>
|
|
||||||
inline
|
|
||||||
void
|
|
||||||
ignore_unused(Ts const& ...)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class... Ts>
|
|
||||||
inline
|
|
||||||
void
|
|
||||||
ignore_unused()
|
|
||||||
{}
|
|
||||||
|
|
||||||
template<class U>
|
template<class U>
|
||||||
std::size_t constexpr
|
std::size_t constexpr
|
||||||
max_sizeof()
|
max_sizeof()
|
||||||
|
@@ -134,8 +134,9 @@ public:
|
|||||||
template<class U>
|
template<class U>
|
||||||
friend
|
friend
|
||||||
bool
|
bool
|
||||||
operator==(handler_alloc const& lhs,
|
operator==(
|
||||||
handler_alloc<U, Handler> const& rhs)
|
handler_alloc const&,
|
||||||
|
handler_alloc<U, Handler> const&)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -143,7 +144,8 @@ public:
|
|||||||
template<class U>
|
template<class U>
|
||||||
friend
|
friend
|
||||||
bool
|
bool
|
||||||
operator!=(handler_alloc const& lhs,
|
operator!=(
|
||||||
|
handler_alloc const& lhs,
|
||||||
handler_alloc<U, Handler> const& rhs)
|
handler_alloc<U, Handler> const& rhs)
|
||||||
{
|
{
|
||||||
return ! (lhs == rhs);
|
return ! (lhs == rhs);
|
||||||
|
@@ -524,7 +524,7 @@ assign_char(CharT ch, std::true_type) ->
|
|||||||
template<std::size_t N, class CharT, class Traits>
|
template<std::size_t N, class CharT, class Traits>
|
||||||
auto
|
auto
|
||||||
static_string<N, CharT, Traits>::
|
static_string<N, CharT, Traits>::
|
||||||
assign_char(CharT ch, std::false_type) ->
|
assign_char(CharT, std::false_type) ->
|
||||||
static_string&
|
static_string&
|
||||||
{
|
{
|
||||||
BOOST_THROW_EXCEPTION(std::length_error{
|
BOOST_THROW_EXCEPTION(std::length_error{
|
||||||
|
@@ -90,7 +90,7 @@ struct empty_body
|
|||||||
{
|
{
|
||||||
template<bool isRequest, class Fields>
|
template<bool isRequest, class Fields>
|
||||||
explicit
|
explicit
|
||||||
writer(message<isRequest, empty_body, Fields>& msg)
|
writer(message<isRequest, empty_body, Fields>&)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -230,7 +230,7 @@ template<class Allocator>
|
|||||||
template<class String>
|
template<class String>
|
||||||
void
|
void
|
||||||
basic_fields<Allocator>::reader::
|
basic_fields<Allocator>::reader::
|
||||||
prepare(String& s, basic_fields const& f,
|
prepare(String& s, basic_fields const&,
|
||||||
unsigned version, verb v)
|
unsigned version, verb v)
|
||||||
{
|
{
|
||||||
if(v == verb::unknown)
|
if(v == verb::unknown)
|
||||||
@@ -271,7 +271,7 @@ template<class Allocator>
|
|||||||
template<class String>
|
template<class String>
|
||||||
void
|
void
|
||||||
basic_fields<Allocator>::reader::
|
basic_fields<Allocator>::reader::
|
||||||
prepare(String& s,basic_fields const& f,
|
prepare(String& s, basic_fields const&,
|
||||||
unsigned version, unsigned code)
|
unsigned version, unsigned code)
|
||||||
{
|
{
|
||||||
if(version == 11)
|
if(version == 11)
|
||||||
|
@@ -318,7 +318,7 @@ class read_msg_op
|
|||||||
message_type& m;
|
message_type& m;
|
||||||
parser_type p;
|
parser_type p;
|
||||||
|
|
||||||
data(Handler& handler, Stream& s_,
|
data(Handler&, Stream& s_,
|
||||||
DynamicBuffer& b_, message_type& m_)
|
DynamicBuffer& b_, message_type& m_)
|
||||||
: s(s_)
|
: s(s_)
|
||||||
, b(b_)
|
, b(b_)
|
||||||
|
@@ -358,7 +358,7 @@ class write_msg_op
|
|||||||
serializer<isRequest,
|
serializer<isRequest,
|
||||||
Body, Fields, no_chunk_decorator> sr;
|
Body, Fields, no_chunk_decorator> sr;
|
||||||
|
|
||||||
data(Handler& h, Stream& s_, message<
|
data(Handler&, Stream& s_, message<
|
||||||
isRequest, Body, Fields>& m_)
|
isRequest, Body, Fields>& m_)
|
||||||
: s(s_)
|
: s(s_)
|
||||||
, sr(m_, no_chunk_decorator{})
|
, sr(m_, no_chunk_decorator{})
|
||||||
|
@@ -175,7 +175,7 @@ class stream<NextLayer>::accept_op
|
|||||||
Decorator decorator;
|
Decorator decorator;
|
||||||
http::request_parser<http::empty_body> p;
|
http::request_parser<http::empty_body> p;
|
||||||
|
|
||||||
data(Handler& handler, stream<NextLayer>& ws_,
|
data(Handler&, stream<NextLayer>& ws_,
|
||||||
Decorator const& decorator_)
|
Decorator const& decorator_)
|
||||||
: ws(ws_)
|
: ws(ws_)
|
||||||
, decorator(decorator_)
|
, decorator(decorator_)
|
||||||
@@ -183,7 +183,7 @@ class stream<NextLayer>::accept_op
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class Buffers>
|
template<class Buffers>
|
||||||
data(Handler& handler, stream<NextLayer>& ws_,
|
data(Handler&, stream<NextLayer>& ws_,
|
||||||
Buffers const& buffers,
|
Buffers const& buffers,
|
||||||
Decorator const& decorator_)
|
Decorator const& decorator_)
|
||||||
: ws(ws_)
|
: ws(ws_)
|
||||||
|
@@ -559,7 +559,7 @@ class stream<NextLayer>::write_op
|
|||||||
consuming_buffers<Buffers> cb;
|
consuming_buffers<Buffers> cb;
|
||||||
std::size_t remain;
|
std::size_t remain;
|
||||||
|
|
||||||
data(Handler& handler, stream<NextLayer>& ws_,
|
data(Handler&, stream<NextLayer>& ws_,
|
||||||
Buffers const& bs)
|
Buffers const& bs)
|
||||||
: ws(ws_)
|
: ws(ws_)
|
||||||
, cb(bs)
|
, cb(bs)
|
||||||
|
@@ -3099,13 +3099,13 @@ private:
|
|||||||
|
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
default_decorate_req(request_type& res)
|
default_decorate_req(request_type&)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
default_decorate_res(response_type& res)
|
default_decorate_res(response_type&)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -768,31 +768,30 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
on_field(std::string const& field, std::string const& value)
|
on_field(std::string const&, std::string const&)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
on_headers_complete(error_code&)
|
on_headers_complete(error_code& ec)
|
||||||
{
|
{
|
||||||
// vFALCO TODO Decode the Content-Length and
|
// vFALCO TODO Decode the Content-Length and
|
||||||
// Transfer-Encoding, see if we can reserve the buffer.
|
// Transfer-Encoding, see if we can reserve the buffer.
|
||||||
//
|
//
|
||||||
// r_.reserve(content_length)
|
// r_.reserve(content_length)
|
||||||
|
ec.assign(0, ec.category());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
on_request(unsigned method, std::string const& url,
|
on_request(unsigned, std::string const&,
|
||||||
int major, int minor, bool /*keep_alive*/, bool /*upgrade*/,
|
int, int, bool, bool, std::true_type)
|
||||||
std::true_type)
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
on_request(unsigned, std::string const&,
|
on_request(unsigned, std::string const&,
|
||||||
int, int, bool, bool,
|
int, int, bool, bool, std::false_type)
|
||||||
std::false_type)
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -808,11 +807,9 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
on_response(int status, std::string const& reason,
|
on_response(int, std::string const&,
|
||||||
int major, int minor, bool keep_alive, bool upgrade,
|
int, int, bool, bool, std::true_type)
|
||||||
std::true_type)
|
|
||||||
{
|
{
|
||||||
beast::detail::ignore_unused(keep_alive, upgrade);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -833,9 +830,9 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
on_body(void const* data,
|
on_body(void const*, std::size_t, error_code& ec)
|
||||||
std::size_t size, error_code& ec)
|
|
||||||
{
|
{
|
||||||
|
ec.assign(0, ec.category());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@@ -160,7 +160,7 @@ public:
|
|||||||
other.moved_from = true;
|
other.moved_from = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveFields& operator=(MoveFields&& other)
|
MoveFields& operator=(MoveFields&&)
|
||||||
{
|
{
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@@ -79,7 +79,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
on_field(field f, string_view,
|
on_field(field, string_view,
|
||||||
string_view, error_code& ec)
|
string_view, error_code& ec)
|
||||||
{
|
{
|
||||||
got_on_field = true;
|
got_on_field = true;
|
||||||
|
@@ -678,7 +678,7 @@ public:
|
|||||||
isRequest, Body, Fields> const& m, error_code& ec,
|
isRequest, Body, Fields> const& m, error_code& ec,
|
||||||
Decorator const& decorator = Decorator{})
|
Decorator const& decorator = Decorator{})
|
||||||
{
|
{
|
||||||
serializer<isRequest, Body, Fields, Decorator> sr{m};
|
serializer<isRequest, Body, Fields, Decorator> sr{m, decorator};
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
stream.nwrite = 0;
|
stream.nwrite = 0;
|
||||||
@@ -700,7 +700,7 @@ public:
|
|||||||
error_code& ec, yield_context yield,
|
error_code& ec, yield_context yield,
|
||||||
Decorator const& decorator = Decorator{})
|
Decorator const& decorator = Decorator{})
|
||||||
{
|
{
|
||||||
serializer<isRequest, Body, Fields, Decorator> sr{m};
|
serializer<isRequest, Body, Fields, Decorator> sr{m, decorator};
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
stream.nwrite = 0;
|
stream.nwrite = 0;
|
||||||
|
@@ -191,6 +191,7 @@ boost::asio::ip::tcp::socket sock{ios};
|
|||||||
[](bool is_pong, ping_data const& payload)
|
[](bool is_pong, ping_data const& payload)
|
||||||
{
|
{
|
||||||
// Do something with the payload
|
// Do something with the payload
|
||||||
|
boost::ignore_unused(is_pong, payload);
|
||||||
});
|
});
|
||||||
//]
|
//]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user