Fix unused variable warnings

This commit is contained in:
Vinnie Falco
2017-06-22 10:27:45 -07:00
parent 58c976ea73
commit 8f4e7fd0a0
25 changed files with 54 additions and 51 deletions

View File

@ -950,6 +950,7 @@ void custom_parser<isRequest>::
on_request(verb method, string_view method_str,
string_view path, int version, error_code& ec)
{
boost::ignore_unused(method, method_str, path, version);
ec = {};
}
@ -958,6 +959,7 @@ void custom_parser<isRequest>::
on_response(int status, string_view reason,
int version, error_code& ec)
{
boost::ignore_unused(status, reason, version);
ec = {};
}
@ -966,6 +968,7 @@ void custom_parser<isRequest>::
on_field(field f, string_view name,
string_view value, error_code& ec)
{
boost::ignore_unused(f, name, value);
ec = {};
}
@ -981,6 +984,7 @@ void custom_parser<isRequest>::
on_body(boost::optional<std::uint64_t> const& content_length,
error_code& ec)
{
boost::ignore_unused(content_length);
ec = {};
}
@ -988,6 +992,7 @@ template<bool isRequest>
void custom_parser<isRequest>::
on_data(string_view s, error_code& ec)
{
boost::ignore_unused(s);
ec = {};
}
@ -996,6 +1001,7 @@ void custom_parser<isRequest>::
on_chunk(std::uint64_t size,
string_view extension, error_code& ec)
{
boost::ignore_unused(size, extension);
ec = {};
}

View File

@ -8,6 +8,7 @@
#include <beast/core.hpp>
#include <boost/asio.hpp>
#include <cstddef>
#include <iostream>
#include <memory>
#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 socket_type = boost::asio::ip::tcp::socket;
@ -347,6 +348,8 @@ int main()
async_echo(sock,
[&](beast::error_code ec)
{
if(ec)
std::cerr << argv[0] << ": " << ec.message() << std::endl;
});
ios.run();
return 0;

View File

@ -346,6 +346,8 @@ void
file_body::writer::
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
file_ = fopen(path_.string().c_str(), "wb");

View File

@ -111,6 +111,8 @@ public:
beast::http::request<Body, Fields>&& req,
Send const& send) const
{
boost::ignore_unused(ep);
// Determine our action based on the method
switch(req.method())
{
@ -219,6 +221,7 @@ private:
beast::http::request<Body, Fields> const& req,
boost::filesystem::path const& rel_path) const
{
boost::ignore_unused(rel_path);
beast::http::response<beast::http::string_body> res;
res.version = req.version;
res.result(beast::http::status::not_found);

View File

@ -119,7 +119,7 @@ ssl_certificate::construct()
"-----END DH PARAMETERS-----\n";
ctx_.set_password_callback(
[](std::size_t size,
[](std::size_t,
boost::asio::ssl::context_base::password_purpose)
{
return "test";

View File

@ -57,6 +57,7 @@ class write_msg_op
: stream(stream_)
, msg(std::move(msg_))
{
boost::ignore_unused(handler);
}
};

View File

@ -148,7 +148,7 @@ public:
friend
void
teardown(websocket::teardown_tag,
string_iostream& stream,
string_iostream&,
boost::system::error_code& ec)
{
ec.assign(0, ec.category());

View File

@ -136,7 +136,7 @@ public:
friend
void
teardown(websocket::teardown_tag,
string_istream& stream,
string_istream&,
boost::system::error_code& ec)
{
ec.assign(0, ec.category());

View File

@ -57,7 +57,7 @@ public:
template<class MutableBufferSequence>
std::size_t
read_some(MutableBufferSequence const& buffers,
read_some(MutableBufferSequence const&,
error_code& ec)
{
ec = boost::asio::error::eof;
@ -67,7 +67,7 @@ public:
template<class MutableBufferSequence, class ReadHandler>
async_return_type<
ReadHandler, void(error_code, std::size_t)>
async_read_some(MutableBufferSequence const& buffers,
async_read_some(MutableBufferSequence const&,
ReadHandler&& handler)
{
async_completion<ReadHandler,
@ -124,7 +124,7 @@ public:
friend
void
teardown(websocket::teardown_tag,
string_ostream& stream,
string_ostream&,
boost::system::error_code& ec)
{
ec.assign(0, ec.category());

View File

@ -8,6 +8,7 @@
#ifndef BEAST_CONFIG_HPP
#define BEAST_CONFIG_HPP
#include <boost/core/ignore_unused.hpp>
#include <boost/static_assert.hpp>
/*

View File

@ -62,19 +62,6 @@ inline
void
accept_rv(T){}
template<class... Ts>
inline
void
ignore_unused(Ts const& ...)
{
}
template<class... Ts>
inline
void
ignore_unused()
{}
template<class U>
std::size_t constexpr
max_sizeof()

View File

@ -134,8 +134,9 @@ public:
template<class U>
friend
bool
operator==(handler_alloc const& lhs,
handler_alloc<U, Handler> const& rhs)
operator==(
handler_alloc const&,
handler_alloc<U, Handler> const&)
{
return true;
}
@ -143,7 +144,8 @@ public:
template<class U>
friend
bool
operator!=(handler_alloc const& lhs,
operator!=(
handler_alloc const& lhs,
handler_alloc<U, Handler> const& rhs)
{
return ! (lhs == rhs);

View File

@ -524,7 +524,7 @@ assign_char(CharT ch, std::true_type) ->
template<std::size_t N, class CharT, class Traits>
auto
static_string<N, CharT, Traits>::
assign_char(CharT ch, std::false_type) ->
assign_char(CharT, std::false_type) ->
static_string&
{
BOOST_THROW_EXCEPTION(std::length_error{

View File

@ -90,7 +90,7 @@ struct empty_body
{
template<bool isRequest, class Fields>
explicit
writer(message<isRequest, empty_body, Fields>& msg)
writer(message<isRequest, empty_body, Fields>&)
{
}

View File

@ -230,7 +230,7 @@ template<class Allocator>
template<class String>
void
basic_fields<Allocator>::reader::
prepare(String& s, basic_fields const& f,
prepare(String& s, basic_fields const&,
unsigned version, verb v)
{
if(v == verb::unknown)
@ -271,7 +271,7 @@ template<class Allocator>
template<class String>
void
basic_fields<Allocator>::reader::
prepare(String& s,basic_fields const& f,
prepare(String& s, basic_fields const&,
unsigned version, unsigned code)
{
if(version == 11)

View File

@ -318,7 +318,7 @@ class read_msg_op
message_type& m;
parser_type p;
data(Handler& handler, Stream& s_,
data(Handler&, Stream& s_,
DynamicBuffer& b_, message_type& m_)
: s(s_)
, b(b_)

View File

@ -358,7 +358,7 @@ class write_msg_op
serializer<isRequest,
Body, Fields, no_chunk_decorator> sr;
data(Handler& h, Stream& s_, message<
data(Handler&, Stream& s_, message<
isRequest, Body, Fields>& m_)
: s(s_)
, sr(m_, no_chunk_decorator{})

View File

@ -175,7 +175,7 @@ class stream<NextLayer>::accept_op
Decorator decorator;
http::request_parser<http::empty_body> p;
data(Handler& handler, stream<NextLayer>& ws_,
data(Handler&, stream<NextLayer>& ws_,
Decorator const& decorator_)
: ws(ws_)
, decorator(decorator_)
@ -183,7 +183,7 @@ class stream<NextLayer>::accept_op
}
template<class Buffers>
data(Handler& handler, stream<NextLayer>& ws_,
data(Handler&, stream<NextLayer>& ws_,
Buffers const& buffers,
Decorator const& decorator_)
: ws(ws_)

View File

@ -559,7 +559,7 @@ class stream<NextLayer>::write_op
consuming_buffers<Buffers> cb;
std::size_t remain;
data(Handler& handler, stream<NextLayer>& ws_,
data(Handler&, stream<NextLayer>& ws_,
Buffers const& bs)
: ws(ws_)
, cb(bs)

View File

@ -3099,13 +3099,13 @@ private:
static
void
default_decorate_req(request_type& res)
default_decorate_req(request_type&)
{
}
static
void
default_decorate_res(response_type& res)
default_decorate_res(response_type&)
{
}

View File

@ -768,31 +768,30 @@ private:
}
void
on_field(std::string const& field, std::string const& value)
on_field(std::string const&, std::string const&)
{
}
void
on_headers_complete(error_code&)
on_headers_complete(error_code& ec)
{
// vFALCO TODO Decode the Content-Length and
// Transfer-Encoding, see if we can reserve the buffer.
//
// r_.reserve(content_length)
ec.assign(0, ec.category());
}
bool
on_request(unsigned method, std::string const& url,
int major, int minor, bool /*keep_alive*/, bool /*upgrade*/,
std::true_type)
on_request(unsigned, std::string const&,
int, int, bool, bool, std::true_type)
{
return true;
}
bool
on_request(unsigned, std::string const&,
int, int, bool, bool,
std::false_type)
int, int, bool, bool, std::false_type)
{
return true;
}
@ -808,11 +807,9 @@ private:
}
bool
on_response(int status, std::string const& reason,
int major, int minor, bool keep_alive, bool upgrade,
std::true_type)
on_response(int, std::string const&,
int, int, bool, bool, std::true_type)
{
beast::detail::ignore_unused(keep_alive, upgrade);
return true;
}
@ -833,9 +830,9 @@ private:
}
void
on_body(void const* data,
std::size_t size, error_code& ec)
on_body(void const*, std::size_t, error_code& ec)
{
ec.assign(0, ec.category());
}
void

View File

@ -160,7 +160,7 @@ public:
other.moved_from = true;
}
MoveFields& operator=(MoveFields&& other)
MoveFields& operator=(MoveFields&&)
{
return *this;
}

View File

@ -79,7 +79,7 @@ public:
}
void
on_field(field f, string_view,
on_field(field, string_view,
string_view, error_code& ec)
{
got_on_field = true;

View File

@ -678,7 +678,7 @@ public:
isRequest, Body, Fields> const& m, error_code& ec,
Decorator const& decorator = Decorator{})
{
serializer<isRequest, Body, Fields, Decorator> sr{m};
serializer<isRequest, Body, Fields, Decorator> sr{m, decorator};
for(;;)
{
stream.nwrite = 0;
@ -700,7 +700,7 @@ public:
error_code& ec, yield_context yield,
Decorator const& decorator = Decorator{})
{
serializer<isRequest, Body, Fields, Decorator> sr{m};
serializer<isRequest, Body, Fields, Decorator> sr{m, decorator};
for(;;)
{
stream.nwrite = 0;

View File

@ -191,6 +191,7 @@ boost::asio::ip::tcp::socket sock{ios};
[](bool is_pong, ping_data const& payload)
{
// Do something with the payload
boost::ignore_unused(is_pong, payload);
});
//]