Make library buildable with -Werror=effc++
Adding initialization of several members to avoid the error: ... should be initialized in the member initialization list Deleting copy constructors and assignment operators for classes with pointer data member to avoid the error: ... has pointer data members but does not override ...
This commit is contained in:
parent
e326df211b
commit
74ebbd2912
@ -52,6 +52,16 @@ class binary_reader
|
|||||||
assert(ia);
|
assert(ia);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~binary_reader() = default;
|
||||||
|
|
||||||
|
// delete copy constructor and assignment operator since
|
||||||
|
// exclusive access to the input adapter is assumed
|
||||||
|
binary_reader(const binary_reader&) = delete;
|
||||||
|
binary_reader& operator=(const binary_reader&) = delete;
|
||||||
|
|
||||||
|
binary_reader(binary_reader&&) = default;
|
||||||
|
binary_reader& operator=(binary_reader&&) = default;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@param[in] format the binary format to parse
|
@param[in] format the binary format to parse
|
||||||
@param[in] sax_ a SAX event processor
|
@param[in] sax_ a SAX event processor
|
||||||
|
|||||||
@ -58,6 +58,14 @@ class file_input_adapter : public input_adapter_protocol
|
|||||||
: m_file(f)
|
: m_file(f)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
// this class is only a wrapper around the file pointer and does
|
||||||
|
// not own it, so the defaults are safe
|
||||||
|
~file_input_adapter() = default;
|
||||||
|
file_input_adapter(const file_input_adapter&) = default;
|
||||||
|
file_input_adapter& operator=(const file_input_adapter&) = default;
|
||||||
|
file_input_adapter(file_input_adapter&&) = default;
|
||||||
|
file_input_adapter& operator=(file_input_adapter&&) = default;
|
||||||
|
|
||||||
std::char_traits<char>::int_type get_character() noexcept override
|
std::char_traits<char>::int_type get_character() noexcept override
|
||||||
{
|
{
|
||||||
return std::fgetc(m_file);
|
return std::fgetc(m_file);
|
||||||
|
|||||||
@ -158,6 +158,16 @@ class json_sax_dom_parser
|
|||||||
: root(r), allow_exceptions(allow_exceptions_)
|
: root(r), allow_exceptions(allow_exceptions_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
~json_sax_dom_parser() = default;
|
||||||
|
|
||||||
|
// delete copy constructor and assignment operator since
|
||||||
|
// exclusive access to the JSON value to be manipulated is assumed
|
||||||
|
json_sax_dom_parser(const json_sax_dom_parser&) = delete;
|
||||||
|
json_sax_dom_parser& operator=(const json_sax_dom_parser&) = delete;
|
||||||
|
|
||||||
|
json_sax_dom_parser(json_sax_dom_parser&&) = default;
|
||||||
|
json_sax_dom_parser& operator=(json_sax_dom_parser&&) = default;
|
||||||
|
|
||||||
bool null()
|
bool null()
|
||||||
{
|
{
|
||||||
handle_value(nullptr);
|
handle_value(nullptr);
|
||||||
@ -306,7 +316,7 @@ class json_sax_dom_parser
|
|||||||
/// the parsed JSON value
|
/// the parsed JSON value
|
||||||
BasicJsonType& root;
|
BasicJsonType& root;
|
||||||
/// stack to model hierarchy of values
|
/// stack to model hierarchy of values
|
||||||
std::vector<BasicJsonType*> ref_stack;
|
std::vector<BasicJsonType*> ref_stack {};
|
||||||
/// helper to hold the reference for the next object element
|
/// helper to hold the reference for the next object element
|
||||||
BasicJsonType* object_element = nullptr;
|
BasicJsonType* object_element = nullptr;
|
||||||
/// whether a syntax error occurred
|
/// whether a syntax error occurred
|
||||||
@ -334,6 +344,16 @@ class json_sax_dom_callback_parser
|
|||||||
keep_stack.push_back(true);
|
keep_stack.push_back(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~json_sax_dom_callback_parser() = default;
|
||||||
|
|
||||||
|
// delete copy constructor and assignment operator since
|
||||||
|
// exclusive access to the JSON value to be manipulated is assumed
|
||||||
|
json_sax_dom_callback_parser(const json_sax_dom_callback_parser&) = delete;
|
||||||
|
json_sax_dom_callback_parser& operator=(const json_sax_dom_callback_parser&) = delete;
|
||||||
|
|
||||||
|
json_sax_dom_callback_parser(json_sax_dom_callback_parser&&) = default;
|
||||||
|
json_sax_dom_callback_parser& operator=(json_sax_dom_callback_parser&&) = default;
|
||||||
|
|
||||||
bool null()
|
bool null()
|
||||||
{
|
{
|
||||||
handle_value(nullptr);
|
handle_value(nullptr);
|
||||||
@ -611,11 +631,11 @@ class json_sax_dom_callback_parser
|
|||||||
/// the parsed JSON value
|
/// the parsed JSON value
|
||||||
BasicJsonType& root;
|
BasicJsonType& root;
|
||||||
/// stack to model hierarchy of values
|
/// stack to model hierarchy of values
|
||||||
std::vector<BasicJsonType*> ref_stack;
|
std::vector<BasicJsonType*> ref_stack {};
|
||||||
/// stack to manage which values to keep
|
/// stack to manage which values to keep
|
||||||
std::vector<bool> keep_stack;
|
std::vector<bool> keep_stack {};
|
||||||
/// stack to manage which object keys to keep
|
/// stack to manage which object keys to keep
|
||||||
std::vector<bool> key_keep_stack;
|
std::vector<bool> key_keep_stack {};
|
||||||
/// helper to hold the reference for the next object element
|
/// helper to hold the reference for the next object element
|
||||||
BasicJsonType* object_element = nullptr;
|
BasicJsonType* object_element = nullptr;
|
||||||
/// whether a syntax error occurred
|
/// whether a syntax error occurred
|
||||||
|
|||||||
@ -1483,7 +1483,7 @@ scan_number_done:
|
|||||||
bool next_unget = false;
|
bool next_unget = false;
|
||||||
|
|
||||||
/// the start position of the current token
|
/// the start position of the current token
|
||||||
position_t position;
|
position_t position {};
|
||||||
|
|
||||||
/// raw input token string (for error messages)
|
/// raw input token string (for error messages)
|
||||||
std::vector<char> token_string {};
|
std::vector<char> token_string {};
|
||||||
|
|||||||
@ -607,7 +607,7 @@ class iter_impl
|
|||||||
/// associated JSON instance
|
/// associated JSON instance
|
||||||
pointer m_object = nullptr;
|
pointer m_object = nullptr;
|
||||||
/// the actual iterator of the associated instance
|
/// the actual iterator of the associated instance
|
||||||
internal_iterator<typename std::remove_const<BasicJsonType>::type> m_it;
|
internal_iterator<typename std::remove_const<BasicJsonType>::type> m_it {};
|
||||||
};
|
};
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
} // namespace nlohmann
|
} // namespace nlohmann
|
||||||
|
|||||||
@ -2222,6 +2222,14 @@ class file_input_adapter : public input_adapter_protocol
|
|||||||
: m_file(f)
|
: m_file(f)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
// this class is only a wrapper around the file pointer and does
|
||||||
|
// not own it, so the defaults are safe
|
||||||
|
~file_input_adapter() = default;
|
||||||
|
file_input_adapter(const file_input_adapter&) = default;
|
||||||
|
file_input_adapter& operator=(const file_input_adapter&) = default;
|
||||||
|
file_input_adapter(file_input_adapter&&) = default;
|
||||||
|
file_input_adapter& operator=(file_input_adapter&&) = default;
|
||||||
|
|
||||||
std::char_traits<char>::int_type get_character() noexcept override
|
std::char_traits<char>::int_type get_character() noexcept override
|
||||||
{
|
{
|
||||||
return std::fgetc(m_file);
|
return std::fgetc(m_file);
|
||||||
@ -4074,7 +4082,7 @@ scan_number_done:
|
|||||||
bool next_unget = false;
|
bool next_unget = false;
|
||||||
|
|
||||||
/// the start position of the current token
|
/// the start position of the current token
|
||||||
position_t position;
|
position_t position {};
|
||||||
|
|
||||||
/// raw input token string (for error messages)
|
/// raw input token string (for error messages)
|
||||||
std::vector<char> token_string {};
|
std::vector<char> token_string {};
|
||||||
@ -4420,6 +4428,16 @@ class json_sax_dom_parser
|
|||||||
: root(r), allow_exceptions(allow_exceptions_)
|
: root(r), allow_exceptions(allow_exceptions_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
~json_sax_dom_parser() = default;
|
||||||
|
|
||||||
|
// delete copy constructor and assignment operator since
|
||||||
|
// exclusive access to the JSON value to be manipulated is assumed
|
||||||
|
json_sax_dom_parser(const json_sax_dom_parser&) = delete;
|
||||||
|
json_sax_dom_parser& operator=(const json_sax_dom_parser&) = delete;
|
||||||
|
|
||||||
|
json_sax_dom_parser(json_sax_dom_parser&&) = default;
|
||||||
|
json_sax_dom_parser& operator=(json_sax_dom_parser&&) = default;
|
||||||
|
|
||||||
bool null()
|
bool null()
|
||||||
{
|
{
|
||||||
handle_value(nullptr);
|
handle_value(nullptr);
|
||||||
@ -4568,7 +4586,7 @@ class json_sax_dom_parser
|
|||||||
/// the parsed JSON value
|
/// the parsed JSON value
|
||||||
BasicJsonType& root;
|
BasicJsonType& root;
|
||||||
/// stack to model hierarchy of values
|
/// stack to model hierarchy of values
|
||||||
std::vector<BasicJsonType*> ref_stack;
|
std::vector<BasicJsonType*> ref_stack {};
|
||||||
/// helper to hold the reference for the next object element
|
/// helper to hold the reference for the next object element
|
||||||
BasicJsonType* object_element = nullptr;
|
BasicJsonType* object_element = nullptr;
|
||||||
/// whether a syntax error occurred
|
/// whether a syntax error occurred
|
||||||
@ -4596,6 +4614,16 @@ class json_sax_dom_callback_parser
|
|||||||
keep_stack.push_back(true);
|
keep_stack.push_back(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~json_sax_dom_callback_parser() = default;
|
||||||
|
|
||||||
|
// delete copy constructor and assignment operator since
|
||||||
|
// exclusive access to the JSON value to be manipulated is assumed
|
||||||
|
json_sax_dom_callback_parser(const json_sax_dom_callback_parser&) = delete;
|
||||||
|
json_sax_dom_callback_parser& operator=(const json_sax_dom_callback_parser&) = delete;
|
||||||
|
|
||||||
|
json_sax_dom_callback_parser(json_sax_dom_callback_parser&&) = default;
|
||||||
|
json_sax_dom_callback_parser& operator=(json_sax_dom_callback_parser&&) = default;
|
||||||
|
|
||||||
bool null()
|
bool null()
|
||||||
{
|
{
|
||||||
handle_value(nullptr);
|
handle_value(nullptr);
|
||||||
@ -4873,11 +4901,11 @@ class json_sax_dom_callback_parser
|
|||||||
/// the parsed JSON value
|
/// the parsed JSON value
|
||||||
BasicJsonType& root;
|
BasicJsonType& root;
|
||||||
/// stack to model hierarchy of values
|
/// stack to model hierarchy of values
|
||||||
std::vector<BasicJsonType*> ref_stack;
|
std::vector<BasicJsonType*> ref_stack {};
|
||||||
/// stack to manage which values to keep
|
/// stack to manage which values to keep
|
||||||
std::vector<bool> keep_stack;
|
std::vector<bool> keep_stack {};
|
||||||
/// stack to manage which object keys to keep
|
/// stack to manage which object keys to keep
|
||||||
std::vector<bool> key_keep_stack;
|
std::vector<bool> key_keep_stack {};
|
||||||
/// helper to hold the reference for the next object element
|
/// helper to hold the reference for the next object element
|
||||||
BasicJsonType* object_element = nullptr;
|
BasicJsonType* object_element = nullptr;
|
||||||
/// whether a syntax error occurred
|
/// whether a syntax error occurred
|
||||||
@ -6223,10 +6251,11 @@ class iter_impl
|
|||||||
/// associated JSON instance
|
/// associated JSON instance
|
||||||
pointer m_object = nullptr;
|
pointer m_object = nullptr;
|
||||||
/// the actual iterator of the associated instance
|
/// the actual iterator of the associated instance
|
||||||
internal_iterator<typename std::remove_const<BasicJsonType>::type> m_it;
|
internal_iterator<typename std::remove_const<BasicJsonType>::type> m_it {};
|
||||||
};
|
};
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
} // namespace nlohmann
|
} // namespace nlohmann
|
||||||
|
|
||||||
// #include <nlohmann/detail/iterators/iteration_proxy.hpp>
|
// #include <nlohmann/detail/iterators/iteration_proxy.hpp>
|
||||||
|
|
||||||
// #include <nlohmann/detail/iterators/json_reverse_iterator.hpp>
|
// #include <nlohmann/detail/iterators/json_reverse_iterator.hpp>
|
||||||
@ -6532,6 +6561,16 @@ class binary_reader
|
|||||||
assert(ia);
|
assert(ia);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~binary_reader() = default;
|
||||||
|
|
||||||
|
// delete copy constructor and assignment operator since
|
||||||
|
// exclusive access to the input adapter is assumed
|
||||||
|
binary_reader(const binary_reader&) = delete;
|
||||||
|
binary_reader& operator=(const binary_reader&) = delete;
|
||||||
|
|
||||||
|
binary_reader(binary_reader&&) = default;
|
||||||
|
binary_reader& operator=(binary_reader&&) = default;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@param[in] format the binary format to parse
|
@param[in] format the binary format to parse
|
||||||
@param[in] sax_ a SAX event processor
|
@param[in] sax_ a SAX event processor
|
||||||
|
|||||||
@ -149,7 +149,7 @@ class alt_string
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string str_impl;
|
std::string str_impl {};
|
||||||
|
|
||||||
friend bool ::operator<(const char*, const alt_string&);
|
friend bool ::operator<(const char*, const alt_string&);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -125,7 +125,7 @@ class SaxEventLogger
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> events;
|
std::vector<std::string> events {};
|
||||||
bool errored = false;
|
bool errored = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -123,7 +123,7 @@ struct SaxEventLogger : public nlohmann::json_sax<json>
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> events;
|
std::vector<std::string> events {};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SaxEventLoggerExitAfterStartObject : public SaxEventLogger
|
struct SaxEventLoggerExitAfterStartObject : public SaxEventLogger
|
||||||
|
|||||||
@ -124,8 +124,13 @@ struct nocopy
|
|||||||
|
|
||||||
struct Data
|
struct Data
|
||||||
{
|
{
|
||||||
std::string a;
|
Data() {}
|
||||||
std::string b;
|
|
||||||
|
Data(std::string a, std::string b)
|
||||||
|
: a(std::move(a)), b(std::move(b)) {}
|
||||||
|
|
||||||
|
std::string a {};
|
||||||
|
std::string b {};
|
||||||
};
|
};
|
||||||
|
|
||||||
void from_json(const json& j, Data& data)
|
void from_json(const json& j, Data& data)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user