Skip to content

Commit

Permalink
🚨 fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed Jul 24, 2023
1 parent 5d27543 commit 603dd13
Show file tree
Hide file tree
Showing 39 changed files with 44 additions and 257 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ pretty:
--pad-header \
--align-pointer=type \
--align-reference=type \
--add-brackets \
--add-braces \
--convert-tabs \
--close-templates \
--lineend=linux \
Expand Down
1 change: 0 additions & 1 deletion docs/examples/at__json_pointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ int main()
// output the changed array
std::cout << j["array"] << '\n';


// out_of_range.106
try
{
Expand Down
1 change: 0 additions & 1 deletion docs/examples/at__keytype.c++17.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ int main()
// output changed array
std::cout << object << '\n';


// exception type_error.304
try
{
Expand Down
1 change: 0 additions & 1 deletion docs/examples/at__keytype_const.c++17.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ int main()
// output element with key "the ugly" using string_view
std::cout << object.at("the ugly"sv) << '\n';


// exception type_error.304
try
{
Expand Down
1 change: 0 additions & 1 deletion docs/examples/at__object_t_key_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ int main()
// output changed array
std::cout << object << '\n';


// exception type_error.304
try
{
Expand Down
1 change: 0 additions & 1 deletion docs/examples/at__object_t_key_type_const.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ int main()
// output element with key "the ugly"
std::cout << object.at("the ugly") << '\n';


// exception type_error.304
try
{
Expand Down
1 change: 0 additions & 1 deletion docs/examples/at__size_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ int main()
// output changed array
std::cout << array << '\n';


// exception type_error.304
try
{
Expand Down
1 change: 0 additions & 1 deletion docs/examples/at__size_type_const.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ int main()
// output element at index 2 (third element)
std::cout << array.at(2) << '\n';


// exception type_error.304
try
{
Expand Down
4 changes: 0 additions & 4 deletions docs/examples/basic_json__CompatibleType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ int main()
std::cout << j_mmap << '\n';
std::cout << j_ummap << "\n\n";


// ===========
// array types
// ===========
Expand Down Expand Up @@ -117,7 +116,6 @@ int main()
std::cout << j_mset << '\n';
std::cout << j_umset << "\n\n";


// ============
// string types
// ============
Expand All @@ -138,7 +136,6 @@ int main()
std::cout << j_string_literal << '\n';
std::cout << j_stdstring << "\n\n";


// ============
// number types
// ============
Expand Down Expand Up @@ -203,7 +200,6 @@ int main()
std::cout << j_float_nan << '\n';
std::cout << j_double << "\n\n";


// =============
// boolean types
// =============
Expand Down
1 change: 0 additions & 1 deletion docs/examples/get_to.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ int main()
std::vector<short> v7;
std::unordered_map<std::string, json> v8;


// use explicit conversions
json_types["boolean"].get_to(v1);
json_types["number"]["integer"].get_to(v2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ int main()
json string = "foo";
json discarded = json(json::value_t::discarded);


// output values and comparisons
std::cout << array_1 << " <=> " << array_2 << " := " << to_string(array_1 <=> array_2) << '\n'; // *NOPAD*
std::cout << object_1 << " <=> " << object_2 << " := " << to_string(object_1 <=> object_2) << '\n'; // *NOPAD*
Expand Down
1 change: 0 additions & 1 deletion docs/examples/operator_spaceship__scalartype.c++20.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ int main()
json number = 17;
json string = "17";


// output values and comparisons
std::cout << std::boolalpha << std::fixed;
std::cout << boolean << " <=> " << true << " := " << to_string(boolean <=> true) << '\n'; // *NOPAD*
Expand Down
1 change: 0 additions & 1 deletion docs/examples/parse__istream__parser_callback_t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ int main()
json j_complete = json::parse(ss);
std::cout << std::setw(4) << j_complete << "\n\n";


// define parser callback
json::parser_callback_t cb = [](int depth, json::parse_event_t event, json & parsed)
{
Expand Down
1 change: 0 additions & 1 deletion docs/examples/parse__string__parser_callback_t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ int main()
json j_complete = json::parse(text);
std::cout << std::setw(4) << j_complete << "\n\n";


// define parser callback
json::parser_callback_t cb = [](int depth, json::parse_event_t event, json & parsed)
{
Expand Down
1 change: 0 additions & 1 deletion include/nlohmann/detail/exceptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <nlohmann/detail/meta/type_traits.hpp>
#include <nlohmann/detail/string_concat.hpp>


NLOHMANN_JSON_NAMESPACE_BEGIN
namespace detail
{
Expand Down
1 change: 0 additions & 1 deletion include/nlohmann/detail/input/binary_reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ static inline bool little_endianness(int num = 1) noexcept
return *reinterpret_cast<char*>(&num) == 1;
}


///////////////////
// binary reader //
///////////////////
Expand Down
3 changes: 0 additions & 3 deletions include/nlohmann/detail/input/input_adapters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class file_input_adapter
std::FILE* m_file;
};


/*!
Input adapter for a (caching) istream. Ignores a UFT Byte Order Mark at
beginning of input. Does not support changing the underlying std::streambuf
Expand Down Expand Up @@ -170,7 +169,6 @@ class iterator_input_adapter
}
};


template<typename BaseInputAdapter, size_t T>
struct wide_string_input_helper;

Expand Down Expand Up @@ -339,7 +337,6 @@ class wide_string_input_adapter
std::size_t utf8_bytes_filled = 0;
};


template<typename IteratorType, typename Enable = void>
struct iterator_input_adapter_factory
{
Expand Down
5 changes: 2 additions & 3 deletions include/nlohmann/detail/input/json_sax.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ struct json_sax
virtual ~json_sax() = default;
};


namespace detail
{
/*!
Expand Down Expand Up @@ -591,7 +590,7 @@ class json_sax_dom_callback_parser
if (ref_stack.empty())
{
root = std::move(value);
return {true, &root};
return {true, & root};
}

// skip this value if we already decided to skip the parent
Expand All @@ -608,7 +607,7 @@ class json_sax_dom_callback_parser
if (ref_stack.back()->is_array())
{
ref_stack.back()->m_data.m_value.array->emplace_back(std::move(value));
return {true, &(ref_stack.back()->m_data.m_value.array->back())};
return {true, & (ref_stack.back()->m_data.m_value.array->back())};
}

// object
Expand Down
4 changes: 2 additions & 2 deletions include/nlohmann/detail/iterators/iteration_proxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ template<typename IteratorType> class iteration_proxy_value
// older GCCs are a bit fussy and require explicit noexcept specifiers on defaulted functions
iteration_proxy_value(iteration_proxy_value&&)
noexcept(std::is_nothrow_move_constructible<IteratorType>::value
&& std::is_nothrow_move_constructible<string_type>::value) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor)
&& std::is_nothrow_move_constructible<string_type>::value) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor,cppcoreguidelines-noexcept-move-operations)
iteration_proxy_value& operator=(iteration_proxy_value&&)
noexcept(std::is_nothrow_move_assignable<IteratorType>::value
&& std::is_nothrow_move_assignable<string_type>::value) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor)
&& std::is_nothrow_move_assignable<string_type>::value) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor,cppcoreguidelines-noexcept-move-operations)
~iteration_proxy_value() = default;

/// dereference operator (needed for range-based for)
Expand Down
1 change: 0 additions & 1 deletion include/nlohmann/detail/macro_scope.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,6 @@
inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) }


// inspired from https://stackoverflow.com/a/26745591
// allows to call any std function as if (e.g. with begin):
// using std::begin; begin(x);
Expand Down
3 changes: 0 additions & 3 deletions include/nlohmann/detail/meta/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ template <typename... Ts>
struct is_default_constructible<const std::tuple<Ts...>>
: conjunction<is_default_constructible<Ts>...> {};


template <typename T, typename... Args>
struct is_constructible : std::is_constructible<T, Args...> {};

Expand All @@ -233,7 +232,6 @@ struct is_constructible<std::tuple<Ts...>> : is_default_constructible<std::tuple
template <typename... Ts>
struct is_constructible<const std::tuple<Ts...>> : is_default_constructible<const std::tuple<Ts...>> {};


template<typename T, typename = void>
struct is_iterator_traits : std::false_type {};

Expand Down Expand Up @@ -643,7 +641,6 @@ struct value_in_range_of_impl2<OfType, T, false, true>
}
};


template<typename OfType, typename T>
struct value_in_range_of_impl2<OfType, T, true, true>
{
Expand Down
Loading

0 comments on commit 603dd13

Please sign in to comment.