🚨 fix warnings

This commit is contained in:
Niels Lohmann 2021-01-28 20:00:59 +01:00
parent e2868eed33
commit b5c5eaad5a
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
6 changed files with 15 additions and 13 deletions

View File

@ -5,6 +5,7 @@ Checks: '*,
-cppcoreguidelines-avoid-non-const-global-variables, -cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-macro-usage, -cppcoreguidelines-macro-usage,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay, -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-bounds-constant-array-index,
-cppcoreguidelines-pro-bounds-pointer-arithmetic, -cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-pro-type-reinterpret-cast, -cppcoreguidelines-pro-type-reinterpret-cast,
-cppcoreguidelines-pro-type-union-access, -cppcoreguidelines-pro-type-union-access,
@ -23,14 +24,14 @@ Checks: '*,
-hicpp-uppercase-literal-suffix, -hicpp-uppercase-literal-suffix,
-llvm-header-guard, -llvm-header-guard,
-llvm-include-order, -llvm-include-order,
-llvmlibc-*,
-misc-no-recursion, -misc-no-recursion,
-misc-non-private-member-variables-in-classes, -misc-non-private-member-variables-in-classes,
-modernize-use-trailing-return-type, -modernize-use-trailing-return-type,
-readability-function-size, -readability-function-size,
-readability-magic-numbers, -readability-magic-numbers,
-readability-redundant-access-specifiers, -readability-redundant-access-specifiers,
-readability-uppercase-literal-suffix, -readability-uppercase-literal-suffix'
-llvmlibc-*'
CheckOptions: CheckOptions:
- key: hicpp-special-member-functions.AllowSoleDefaultDtor - key: hicpp-special-member-functions.AllowSoleDefaultDtor

View File

@ -2211,8 +2211,8 @@ class binary_reader
} }
// parse number string // parse number string
auto number_ia = detail::input_adapter(std::forward<decltype(number_vector)>(number_vector)); using ia_type = decltype(detail::input_adapter(std::forward<decltype(number_vector)>(number_vector)));
auto number_lexer = detail::lexer<BasicJsonType, decltype(number_ia)>(std::move(number_ia), false); auto number_lexer = detail::lexer<BasicJsonType, ia_type>(detail::input_adapter(std::forward<decltype(number_vector)>(number_vector)), false);
const auto result_number = number_lexer.scan(); const auto result_number = number_lexer.scan();
const auto number_string = number_lexer.get_token_string(); const auto number_string = number_lexer.get_token_string();
const auto result_remainder = number_lexer.scan(); const auto result_remainder = number_lexer.scan();
@ -2400,7 +2400,7 @@ class binary_reader
std::string get_token_string() const std::string get_token_string() const
{ {
std::array<char, 3> cr{{}}; std::array<char, 3> cr{{}};
(std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast<unsigned char>(current)); (std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast<unsigned char>(current)); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
return std::string{cr.data()}; return std::string{cr.data()};
} }

View File

@ -45,6 +45,7 @@ class file_input_adapter
file_input_adapter(file_input_adapter&&) noexcept = default; file_input_adapter(file_input_adapter&&) noexcept = default;
file_input_adapter& operator=(const file_input_adapter&) = delete; file_input_adapter& operator=(const file_input_adapter&) = delete;
file_input_adapter& operator=(file_input_adapter&&) = delete; file_input_adapter& operator=(file_input_adapter&&) = delete;
~file_input_adapter() = default;
std::char_traits<char>::int_type get_character() noexcept std::char_traits<char>::int_type get_character() noexcept
{ {
@ -465,7 +466,7 @@ class span_input_adapter
contiguous_bytes_input_adapter&& get() contiguous_bytes_input_adapter&& get()
{ {
return std::move(ia); return std::move(ia); // NOLINT(hicpp-move-const-arg,performance-move-const-arg)
} }
private: private:

View File

@ -1447,7 +1447,7 @@ scan_number_done:
{ {
// escape control characters // escape control characters
std::array<char, 9> cs{{}}; std::array<char, 9> cs{{}};
(std::snprintf)(cs.data(), cs.size(), "<U+%.4X>", static_cast<unsigned char>(c)); (std::snprintf)(cs.data(), cs.size(), "<U+%.4X>", static_cast<unsigned char>(c)); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-varar)
result += cs.data(); result += cs.data();
} }
else else

View File

@ -4854,6 +4854,7 @@ class file_input_adapter
file_input_adapter(file_input_adapter&&) noexcept = default; file_input_adapter(file_input_adapter&&) noexcept = default;
file_input_adapter& operator=(const file_input_adapter&) = delete; file_input_adapter& operator=(const file_input_adapter&) = delete;
file_input_adapter& operator=(file_input_adapter&&) = delete; file_input_adapter& operator=(file_input_adapter&&) = delete;
~file_input_adapter() = default;
std::char_traits<char>::int_type get_character() noexcept std::char_traits<char>::int_type get_character() noexcept
{ {
@ -5274,7 +5275,7 @@ class span_input_adapter
contiguous_bytes_input_adapter&& get() contiguous_bytes_input_adapter&& get()
{ {
return std::move(ia); return std::move(ia); // NOLINT(hicpp-move-const-arg,performance-move-const-arg)
} }
private: private:
@ -7435,7 +7436,7 @@ scan_number_done:
{ {
// escape control characters // escape control characters
std::array<char, 9> cs{{}}; std::array<char, 9> cs{{}};
(std::snprintf)(cs.data(), cs.size(), "<U+%.4X>", static_cast<unsigned char>(c)); (std::snprintf)(cs.data(), cs.size(), "<U+%.4X>", static_cast<unsigned char>(c)); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-varar)
result += cs.data(); result += cs.data();
} }
else else
@ -9958,8 +9959,8 @@ class binary_reader
} }
// parse number string // parse number string
auto number_ia = detail::input_adapter(std::forward<decltype(number_vector)>(number_vector)); using ia_type = decltype(detail::input_adapter(std::forward<decltype(number_vector)>(number_vector)));
auto number_lexer = detail::lexer<BasicJsonType, decltype(number_ia)>(std::move(number_ia), false); auto number_lexer = detail::lexer<BasicJsonType, ia_type>(detail::input_adapter(std::forward<decltype(number_vector)>(number_vector)), false);
const auto result_number = number_lexer.scan(); const auto result_number = number_lexer.scan();
const auto number_string = number_lexer.get_token_string(); const auto number_string = number_lexer.get_token_string();
const auto result_remainder = number_lexer.scan(); const auto result_remainder = number_lexer.scan();
@ -10147,7 +10148,7 @@ class binary_reader
std::string get_token_string() const std::string get_token_string() const
{ {
std::array<char, 3> cr{{}}; std::array<char, 3> cr{{}};
(std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast<unsigned char>(current)); (std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast<unsigned char>(current)); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
return std::string{cr.data()}; return std::string{cr.data()};
} }

View File

@ -122,7 +122,6 @@ struct nocopy
nocopy(nocopy&&) = delete; nocopy(nocopy&&) = delete;
nocopy& operator=(const nocopy&) = delete; nocopy& operator=(const nocopy&) = delete;
nocopy& operator=(nocopy&&) = delete; nocopy& operator=(nocopy&&) = delete;
~nocopy() = default;
int val = 0; int val = 0;