forked from boostorg/beast
Fix unused parameter warnings and missing includes:
fix #127 * Added beast::detail::ignore_unused based on boost::ignore_unused * Added -Wextra compilation flag when building with gcc * Fixed all unused parameter warnings with ignore_unused * Fixed all missing includes when building each .hpp separately
This commit is contained in:
committed by
Vinnie Falco
parent
0a1c24eb9f
commit
ed23fd5811
@@ -20,7 +20,7 @@ else()
|
|||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS
|
set(CMAKE_CXX_FLAGS
|
||||||
"${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wpedantic")
|
"${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Wpedantic")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (APPLE AND NOT DEFINED ENV{OPENSSL_ROOT_DIR})
|
if (APPLE AND NOT DEFINED ENV{OPENSSL_ROOT_DIR})
|
||||||
|
@@ -11,6 +11,8 @@
|
|||||||
#include "file_body.hpp"
|
#include "file_body.hpp"
|
||||||
#include "mime_type.hpp"
|
#include "mime_type.hpp"
|
||||||
|
|
||||||
|
#include <beast/http.hpp>
|
||||||
|
#include <beast/core/placeholders.hpp>
|
||||||
#include <beast/core/streambuf.hpp>
|
#include <beast/core/streambuf.hpp>
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@@ -19,6 +21,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <thread>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
#ifndef BEAST_TEST_STRING_STREAM_HPP
|
#ifndef BEAST_TEST_STRING_STREAM_HPP
|
||||||
#define BEAST_TEST_STRING_STREAM_HPP
|
#define BEAST_TEST_STRING_STREAM_HPP
|
||||||
|
|
||||||
|
#include <beast/core/async_completion.hpp>
|
||||||
#include <beast/core/bind_handler.hpp>
|
#include <beast/core/bind_handler.hpp>
|
||||||
#include <beast/core/error.hpp>
|
#include <beast/core/error.hpp>
|
||||||
#include <boost/asio/buffer.hpp>
|
#include <boost/asio/buffer.hpp>
|
||||||
|
@@ -20,6 +20,19 @@ struct make_void
|
|||||||
template<class... Ts>
|
template<class... Ts>
|
||||||
using void_t = typename make_void<Ts...>::type;
|
using void_t = typename make_void<Ts...>::type;
|
||||||
|
|
||||||
|
template<class... Ts>
|
||||||
|
inline
|
||||||
|
void
|
||||||
|
ignore_unused(Ts const& ...)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class... Ts>
|
||||||
|
inline
|
||||||
|
void
|
||||||
|
ignore_unused()
|
||||||
|
{}
|
||||||
|
|
||||||
} // detail
|
} // detail
|
||||||
} // beast
|
} // beast
|
||||||
|
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
#ifndef BEAST_IMPL_BASIC_STREAMBUF_IPP
|
#ifndef BEAST_IMPL_BASIC_STREAMBUF_IPP
|
||||||
#define BEAST_IMPL_BASIC_STREAMBUF_IPP
|
#define BEAST_IMPL_BASIC_STREAMBUF_IPP
|
||||||
|
|
||||||
|
#include <beast/core/detail/type_traits.hpp>
|
||||||
#include <beast/core/detail/write_dynabuf.hpp>
|
#include <beast/core/detail/write_dynabuf.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -786,6 +787,7 @@ void
|
|||||||
basic_streambuf<Allocator>::
|
basic_streambuf<Allocator>::
|
||||||
copy_assign(basic_streambuf const& other, std::false_type)
|
copy_assign(basic_streambuf const& other, std::false_type)
|
||||||
{
|
{
|
||||||
|
beast::detail::ignore_unused(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Allocator>
|
template<class Allocator>
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
#define BEAST_HTTP_BASIC_DYNABUF_BODY_HPP
|
#define BEAST_HTTP_BASIC_DYNABUF_BODY_HPP
|
||||||
|
|
||||||
#include <beast/http/body_type.hpp>
|
#include <beast/http/body_type.hpp>
|
||||||
|
#include <beast/core/detail/type_traits.hpp>
|
||||||
#include <boost/asio/buffer.hpp>
|
#include <boost/asio/buffer.hpp>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
@@ -73,6 +74,7 @@ private:
|
|||||||
void
|
void
|
||||||
init(error_code& ec) noexcept
|
init(error_code& ec) noexcept
|
||||||
{
|
{
|
||||||
|
beast::detail::ignore_unused(ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint64_t
|
std::uint64_t
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
#define BEAST_HTTP_EMPTY_BODY_HPP
|
#define BEAST_HTTP_EMPTY_BODY_HPP
|
||||||
|
|
||||||
#include <beast/http/body_type.hpp>
|
#include <beast/http/body_type.hpp>
|
||||||
|
#include <beast/core/detail/type_traits.hpp>
|
||||||
#include <boost/asio/buffer.hpp>
|
#include <boost/asio/buffer.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -39,11 +40,13 @@ private:
|
|||||||
explicit
|
explicit
|
||||||
writer(message<isRequest, empty_body, Headers> const& m) noexcept
|
writer(message<isRequest, empty_body, Headers> const& m) noexcept
|
||||||
{
|
{
|
||||||
|
beast::detail::ignore_unused(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
init(error_code& ec) noexcept
|
init(error_code& ec) noexcept
|
||||||
{
|
{
|
||||||
|
beast::detail::ignore_unused(ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint64_t
|
std::uint64_t
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
#include <beast/http/concepts.hpp>
|
#include <beast/http/concepts.hpp>
|
||||||
#include <beast/http/rfc7230.hpp>
|
#include <beast/http/rfc7230.hpp>
|
||||||
#include <beast/core/detail/ci_char_traits.hpp>
|
#include <beast/core/detail/ci_char_traits.hpp>
|
||||||
|
#include <beast/core/detail/type_traits.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
@@ -61,6 +62,7 @@ void
|
|||||||
prepare_options(prepare_info& pi,
|
prepare_options(prepare_info& pi,
|
||||||
message<isRequest, Body, Headers>& msg)
|
message<isRequest, Body, Headers>& msg)
|
||||||
{
|
{
|
||||||
|
beast::detail::ignore_unused(pi, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<bool isRequest, class Body, class Headers>
|
template<bool isRequest, class Body, class Headers>
|
||||||
@@ -69,6 +71,7 @@ prepare_option(prepare_info& pi,
|
|||||||
message<isRequest, Body, Headers>& msg,
|
message<isRequest, Body, Headers>& msg,
|
||||||
connection value)
|
connection value)
|
||||||
{
|
{
|
||||||
|
beast::detail::ignore_unused(msg);
|
||||||
pi.connection_value = value;
|
pi.connection_value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,6 +109,7 @@ prepare_content_length(prepare_info& pi,
|
|||||||
message<isRequest, Body, Headers> const& msg,
|
message<isRequest, Body, Headers> const& msg,
|
||||||
std::false_type)
|
std::false_type)
|
||||||
{
|
{
|
||||||
|
beast::detail::ignore_unused(msg);
|
||||||
pi.content_length = boost::none;
|
pi.content_length = boost::none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
#include <beast/http/headers_parser_v1.hpp>
|
#include <beast/http/headers_parser_v1.hpp>
|
||||||
#include <beast/http/message.hpp>
|
#include <beast/http/message.hpp>
|
||||||
#include <beast/core/error.hpp>
|
#include <beast/core/error.hpp>
|
||||||
|
#include <beast/core/detail/type_traits.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@@ -231,13 +232,13 @@ private:
|
|||||||
m_.reason = std::move(this->reason_);
|
m_.reason = std::move(this->reason_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_request(error_code& ec)
|
void on_request(error_code&)
|
||||||
{
|
{
|
||||||
on_request_or_response(
|
on_request_or_response(
|
||||||
std::integral_constant<bool, isRequest>{});
|
std::integral_constant<bool, isRequest>{});
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_response(error_code& ec)
|
void on_response(error_code&)
|
||||||
{
|
{
|
||||||
on_request_or_response(
|
on_request_or_response(
|
||||||
std::integral_constant<bool, isRequest>{});
|
std::integral_constant<bool, isRequest>{});
|
||||||
@@ -256,7 +257,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
on_headers(std::uint64_t, error_code& ec)
|
on_headers(std::uint64_t, error_code&)
|
||||||
{
|
{
|
||||||
flush();
|
flush();
|
||||||
m_.version = 10 * this->http_major() + this->http_minor();
|
m_.version = 10 * this->http_major() + this->http_minor();
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
#define BEAST_HTTP_STRING_BODY_HPP
|
#define BEAST_HTTP_STRING_BODY_HPP
|
||||||
|
|
||||||
#include <beast/http/body_type.hpp>
|
#include <beast/http/body_type.hpp>
|
||||||
|
#include <beast/core/detail/type_traits.hpp>
|
||||||
#include <boost/asio/buffer.hpp>
|
#include <boost/asio/buffer.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -73,6 +74,7 @@ private:
|
|||||||
void
|
void
|
||||||
init(error_code& ec) noexcept
|
init(error_code& ec) noexcept
|
||||||
{
|
{
|
||||||
|
beast::detail::ignore_unused(ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint64_t
|
std::uint64_t
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
#include <beast/core/detail/base64.hpp>
|
#include <beast/core/detail/base64.hpp>
|
||||||
#include <beast/core/detail/sha1.hpp>
|
#include <beast/core/detail/sha1.hpp>
|
||||||
#include <boost/utility/string_ref.hpp>
|
#include <boost/utility/string_ref.hpp>
|
||||||
|
#include <array>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#include <beast/http/read.hpp>
|
#include <beast/http/read.hpp>
|
||||||
#include <beast/core/handler_alloc.hpp>
|
#include <beast/core/handler_alloc.hpp>
|
||||||
#include <beast/core/prepare_buffers.hpp>
|
#include <beast/core/prepare_buffers.hpp>
|
||||||
|
#include <beast/core/detail/type_traits.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
@@ -117,6 +118,7 @@ stream<NextLayer>::accept_op<Handler>::
|
|||||||
operator()(error_code const& ec,
|
operator()(error_code const& ec,
|
||||||
std::size_t bytes_transferred, bool again)
|
std::size_t bytes_transferred, bool again)
|
||||||
{
|
{
|
||||||
|
beast::detail::ignore_unused(bytes_transferred);
|
||||||
auto& d = *d_;
|
auto& d = *d_;
|
||||||
d.cont = d.cont || again;
|
d.cont = d.cont || again;
|
||||||
while(! ec && d.state != 99)
|
while(! ec && d.state != 99)
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include <beast/core/write_dynabuf.hpp>
|
#include <beast/core/write_dynabuf.hpp>
|
||||||
#include <beast/http/detail/basic_parser_v1.hpp>
|
#include <beast/http/detail/basic_parser_v1.hpp>
|
||||||
|
#include <beast/http/detail/rfc7230.hpp>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@@ -795,7 +795,7 @@ private:
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
on_request(unsigned method, std::string const& url,
|
on_request(unsigned method, std::string const& url,
|
||||||
int major, int minor, bool keep_alive, bool upgrade,
|
int major, int minor, bool /*keep_alive*/, bool /*upgrade*/,
|
||||||
std::true_type)
|
std::true_type)
|
||||||
{
|
{
|
||||||
m_.method = detail::method_to_string(method);
|
m_.method = detail::method_to_string(method);
|
||||||
@@ -826,6 +826,7 @@ private:
|
|||||||
int major, int minor, bool keep_alive, bool upgrade,
|
int major, int minor, bool keep_alive, bool upgrade,
|
||||||
std::true_type)
|
std::true_type)
|
||||||
{
|
{
|
||||||
|
beast::detail::ignore_unused(keep_alive, upgrade);
|
||||||
m_.status = status;
|
m_.status = status;
|
||||||
m_.reason = reason;
|
m_.reason = reason;
|
||||||
m_.version = major * 10 + minor;
|
m_.version = major * 10 + minor;
|
||||||
|
@@ -64,7 +64,7 @@ public:
|
|||||||
template<class ConstBufferSequence>
|
template<class ConstBufferSequence>
|
||||||
std::size_t
|
std::size_t
|
||||||
write_some(
|
write_some(
|
||||||
ConstBufferSequence const& buffers, error_code& ec)
|
ConstBufferSequence const& buffers, error_code&)
|
||||||
{
|
{
|
||||||
auto const n = buffer_size(buffers);
|
auto const n = buffer_size(buffers);
|
||||||
using boost::asio::buffer_size;
|
using boost::asio::buffer_size;
|
||||||
@@ -112,6 +112,7 @@ public:
|
|||||||
void
|
void
|
||||||
init(error_code& ec) noexcept
|
init(error_code& ec) noexcept
|
||||||
{
|
{
|
||||||
|
beast::detail::ignore_unused(ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class WriteFunction>
|
template<class WriteFunction>
|
||||||
|
@@ -490,7 +490,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void testClose(endpoint_type const& ep, yield_context do_yield)
|
void testClose(endpoint_type const& ep, yield_context)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
// payload length 1
|
// payload length 1
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
#ifndef BEAST_WEBSOCKET_SYNC_ECHO_PEER_H_INCLUDED
|
#ifndef BEAST_WEBSOCKET_SYNC_ECHO_PEER_H_INCLUDED
|
||||||
#define BEAST_WEBSOCKET_SYNC_ECHO_PEER_H_INCLUDED
|
#define BEAST_WEBSOCKET_SYNC_ECHO_PEER_H_INCLUDED
|
||||||
|
|
||||||
|
#include <beast/core/placeholders.hpp>
|
||||||
#include <beast/core/streambuf.hpp>
|
#include <beast/core/streambuf.hpp>
|
||||||
#include <beast/websocket.hpp>
|
#include <beast/websocket.hpp>
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
@@ -36,7 +37,7 @@ private:
|
|||||||
std::thread thread_;
|
std::thread thread_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
sync_echo_server(bool server, endpoint_type ep)
|
sync_echo_server(bool /*server*/, endpoint_type ep)
|
||||||
: sock_(ios_)
|
: sock_(ios_)
|
||||||
, acceptor_(ios_)
|
, acceptor_(ios_)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user