Commit 6feb2b13 authored by Dennis Jenkins's avatar Dennis Jenkins

Fixed many (but not all) warnings found when compiling with '-Weffc++'. ...

Fixed many (but not all) warnings found when compiling with '-Weffc++'.  Mostly class/struct member initialization, a missing virtual destructor.
parent 432f72aa
...@@ -171,6 +171,9 @@ namespace Async { ...@@ -171,6 +171,9 @@ namespace Async {
struct Core { struct Core {
Core(State _state, TypeId _id) Core(State _state, TypeId _id)
: state(_state) : state(_state)
, exc()
, mtx()
, requests()
, id(_id) , id(_id)
{ } { }
...@@ -217,6 +220,7 @@ namespace Async { ...@@ -217,6 +220,7 @@ namespace Async {
struct CoreT : public Core { struct CoreT : public Core {
CoreT() CoreT()
: Core(State::Pending, TypeId::of<T>()) : Core(State::Pending, TypeId::of<T>())
, storage()
{ } { }
template<class Other> template<class Other>
......
...@@ -165,8 +165,21 @@ public: ...@@ -165,8 +165,21 @@ public:
PROTOTYPE_OF(Aio::Handler, Transport) PROTOTYPE_OF(Aio::Handler, Transport)
Transport() {} Transport()
Transport(const Transport &rhs) { UNUSED(rhs); } : requestsQueue()
, connectionsQueue()
, connections()
, requests()
, timeouts()
{ }
Transport(const Transport &)
: requestsQueue()
, connectionsQueue()
, connections()
, requests()
, timeouts()
{ }
typedef std::function<void()> OnResponseParsed; typedef std::function<void()> OnResponseParsed;
...@@ -284,6 +297,7 @@ public: ...@@ -284,6 +297,7 @@ public:
private: private:
RequestBuilder(Client* const client) RequestBuilder(Client* const client)
: client_(client) : client_(client)
, request_()
, timeout_(std::chrono::milliseconds(0)) , timeout_(std::chrono::milliseconds(0))
{ } { }
......
...@@ -103,6 +103,10 @@ template<typename DT> struct DataTypeValidation { ...@@ -103,6 +103,10 @@ template<typename DT> struct DataTypeValidation {
} // namespace Traits } // namespace Traits
struct ProduceConsume { struct ProduceConsume {
ProduceConsume()
: produce()
, consume()
{ }
std::vector<Http::Mime::MediaType> produce; std::vector<Http::Mime::MediaType> produce;
std::vector<Http::Mime::MediaType> consume; std::vector<Http::Mime::MediaType> consume;
...@@ -152,6 +156,8 @@ struct DataType { ...@@ -152,6 +156,8 @@ struct DataType {
virtual const char* format() const = 0; virtual const char* format() const = 0;
virtual bool validate(const std::string& input) const = 0; virtual bool validate(const std::string& input) const = 0;
virtual ~DataType() {}
}; };
template<typename T> template<typename T>
...@@ -160,6 +166,8 @@ struct DataTypeT : public DataType { ...@@ -160,6 +166,8 @@ struct DataTypeT : public DataType {
const char* format() const { return Traits::DataTypeInfo<T>::format(); } const char* format() const { return Traits::DataTypeInfo<T>::format(); }
bool validate(const std::string& input) const { return Traits::DataTypeValidation<T>::validate(input); } bool validate(const std::string& input) const { return Traits::DataTypeValidation<T>::validate(input); }
virtual ~DataTypeT() {}
}; };
template<typename T> template<typename T>
...@@ -255,6 +263,10 @@ public: ...@@ -255,6 +263,10 @@ public:
bool hasPath(const std::string& name, Http::Method method) const; bool hasPath(const std::string& name, Http::Method method) const;
bool hasPath(const Path& path) const; bool hasPath(const Path& path) const;
PathGroup()
: groups_()
{ }
Group paths(const std::string& name) const; Group paths(const std::string& name) const;
Optional<Path> path(const std::string& name, Http::Method method) const; Optional<Path> path(const std::string& name, Http::Method method) const;
...@@ -351,6 +363,8 @@ private: ...@@ -351,6 +363,8 @@ private:
struct SubPath { struct SubPath {
SubPath(std::string prefix, PathGroup* paths); SubPath(std::string prefix, PathGroup* paths);
SubPath(const SubPath&) = delete;
SubPath& operator=(const SubPath&) = delete;
PathBuilder route(std::string path, Http::Method method, std::string description = ""); PathBuilder route(std::string path, Http::Method method, std::string description = "");
PathBuilder route(PathDecl fragment, std::string description = ""); PathBuilder route(PathDecl fragment, std::string description = "");
...@@ -437,6 +451,10 @@ class Swagger { ...@@ -437,6 +451,10 @@ class Swagger {
public: public:
Swagger(const Description& description) Swagger(const Description& description)
: description_(description) : description_(description)
, uiPath_()
, uiDirectory_()
, apiPath_()
, serializer_()
{ } { }
typedef std::function<std::string (const Description&)> Serializer; typedef std::function<std::string (const Description&)> Serializer;
...@@ -445,7 +463,7 @@ public: ...@@ -445,7 +463,7 @@ public:
Swagger& uiDirectory(std::string dir); Swagger& uiDirectory(std::string dir);
Swagger& apiPath(std::string path); Swagger& apiPath(std::string path);
Swagger& serializer(Serializer serialize); Swagger& serializer(Serializer serialize);
void install(Rest::Router& router); void install(Rest::Router& router);
private: private:
......
...@@ -174,6 +174,8 @@ public: ...@@ -174,6 +174,8 @@ public:
}; };
Queue() Queue()
: head()
, tail(nullptr)
{ {
auto *sentinel = new Entry; auto *sentinel = new Entry;
sentinel->next = nullptr; sentinel->next = nullptr;
......
...@@ -235,6 +235,12 @@ public: ...@@ -235,6 +235,12 @@ public:
Route::Status route(const Http::Request& request, Http::ResponseWriter response); Route::Status route(const Http::Request& request, Http::ResponseWriter response);
Router()
: routes()
, customHandlers()
, notFoundHandler()
{ }
private: private:
void addRoute(Http::Method method, const std::string& resource, void addRoute(Http::Method method, const std::string& resource,
......
...@@ -84,6 +84,8 @@ public: ...@@ -84,6 +84,8 @@ public:
static size_t maxSize; static size_t maxSize;
ArrayStreamBuf() ArrayStreamBuf()
: StreamBuf<CharT>()
, bytes()
{ {
bytes.clear(); bytes.clear();
Base::setg(bytes.data(), bytes.data(), bytes.data() + bytes.size()); Base::setg(bytes.data(), bytes.data(), bytes.data() + bytes.size());
......
...@@ -42,12 +42,14 @@ public: ...@@ -42,12 +42,14 @@ public:
, size_(size) , size_(size)
{ } { }
explicit ViewBase(const T* begin, const T* end) { explicit ViewBase(const T* begin, const T* end)
: begin_(begin)
, size_(0)
{
if (begin > end) { if (begin > end) {
throw std::invalid_argument("begin > end"); throw std::invalid_argument("begin > end");
} }
begin_ = begin;
size_ = std::distance(begin, end); size_ = std::distance(begin, end);
} }
......
...@@ -45,7 +45,10 @@ Info::Info( ...@@ -45,7 +45,10 @@ Info::Info(
: title(std::move(title)) : title(std::move(title))
, version(std::move(version)) , version(std::move(version))
, description(std::move(description)) , description(std::move(description))
{ } , termsOfService()
, contact()
, license()
{ }
PathDecl::PathDecl( PathDecl::PathDecl(
std::string value, Http::Method method) std::string value, Http::Method method)
...@@ -59,6 +62,10 @@ Path::Path( ...@@ -59,6 +62,10 @@ Path::Path(
, method(method) , method(method)
, description(std::move(description)) , description(std::move(description))
, hidden(false) , hidden(false)
, pc()
, parameters()
, responses()
, handler()
{ } { }
std::string std::string
...@@ -191,7 +198,8 @@ PathBuilder::PathBuilder(Path* path) ...@@ -191,7 +198,8 @@ PathBuilder::PathBuilder(Path* path)
SubPath::SubPath( SubPath::SubPath(
std::string prefix, PathGroup* paths) std::string prefix, PathGroup* paths)
: prefix(std::move(prefix)) : prefix(std::move(prefix))
, paths(paths) , parameters()
, paths(paths)
{ } { }
PathBuilder PathBuilder
...@@ -220,7 +228,8 @@ Parameter::Parameter( ...@@ -220,7 +228,8 @@ Parameter::Parameter(
: name(std::move(name)) : name(std::move(name))
, description(std::move(description)) , description(std::move(description))
, required(true) , required(true)
{ } , type()
{ }
Response::Response( Response::Response(
Http::Code statusCode, std::string description) Http::Code statusCode, std::string description)
...@@ -260,6 +269,11 @@ InfoBuilder::license(std::string name, std::string url) { ...@@ -260,6 +269,11 @@ InfoBuilder::license(std::string name, std::string url) {
Description::Description( Description::Description(
std::string title, std::string version, std::string description) std::string title, std::string version, std::string description)
: info_(std::move(title), std::move(version), std::move(description)) : info_(std::move(title), std::move(version), std::move(description))
, host_()
, basePath_()
, schemes_()
, pc()
, paths_()
{ {
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment