mirror of
https://github.com/nlohmann/json.git
synced 2026-06-01 18:49:43 +00:00
🚨 add new CI and fix warnings (#2561)
* ⚗️ move CI targets to CMake * ♻️ add target for cpplint * ♻️ add target for self-contained binaries * ♻️ add targets for iwyu and infer * 🔊 add version output * ♻️ add target for oclint * 🚨 fix warnings * ♻️ rename targets * ♻️ use iwyu properly * 🚨 fix warnings * ♻️ use iwyu properly * ♻️ add target for benchmarks * ♻️ add target for CMake flags * 👷 use GitHub Actions * ⚗️ try to install Clang 11 * ⚗️ try to install GCC 11 * ⚗️ try to install Clang 11 * ⚗️ try to install GCC 11 * ⚗️ add clang analyze target * 🔥 remove Google Benchmark * ⬆️ Google Benchmark 1.5.2 * 🔥 use fetchcontent * 🐧 add target to download a Linux version of CMake * 🔨 fix dependency * 🚨 fix includes * 🚨 fix comment * 🔧 adjust flags for GCC 11.0.0 20210110 (experimental) * 🐳 user Docker image to run CI * 🔧 add target for Valgrind * 👷 add target for Valgrind tests * ⚗️ add Dart * ⏪ remove Dart * ⚗️ do not call ctest in test subdirectory * ⚗️ download test data explicitly * ⚗️ only execute Valgrind tests * ⚗️ fix labels * 🔥 remove unneeded jobs * 🔨 cleanup * 🐛 fix OCLint call * ✅ add targets for offline and git-independent tests * ✅ add targets for C++ language versions and reproducible tests * 🔨 clean up * 👷 add CI steps for cppcheck and cpplint * 🚨 fix warnings from Clang-Tidy * 👷 add CI steps for Clang-Tidy * 🚨 fix warnings * 🔧 select proper binary * 🚨 fix warnings * 🚨 suppress some unhelpful warnings * 🚨 fix warnings * 🎨 fix format * 🚨 fix warnings * 👷 add CI steps for Sanitizers * 🚨 fix warnings * ⚡ add optimization to sanitizer build * 🚨 fix warnings * 🚨 add missing header * 🚨 fix warnings * 👷 add CI step for coverage * 👷 add CI steps for disabled exceptions and implicit conversions * 🚨 fix warnings * 👷 add CI steps for checking indentation * 🐛 fix variable use * 💚 fix build * :heavy_minus_sign: remove CircleCI * 👷 add CI step for diagnostics * 🚨 fix warning * 🔥 clean Travis
This commit is contained in:
@@ -71,16 +71,16 @@ class binary_reader
|
||||
|
||||
@param[in] adapter input adapter to read from
|
||||
*/
|
||||
explicit binary_reader(InputAdapterType&& adapter) : ia(std::move(adapter))
|
||||
explicit binary_reader(InputAdapterType&& adapter) noexcept : ia(std::move(adapter))
|
||||
{
|
||||
(void)detail::is_sax_static_asserts<SAX, BasicJsonType> {};
|
||||
}
|
||||
|
||||
// make class move-only
|
||||
binary_reader(const binary_reader&) = delete;
|
||||
binary_reader(binary_reader&&) = default;
|
||||
binary_reader(binary_reader&&) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor)
|
||||
binary_reader& operator=(const binary_reader&) = delete;
|
||||
binary_reader& operator=(binary_reader&&) = default;
|
||||
binary_reader& operator=(binary_reader&&) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor)
|
||||
~binary_reader() = default;
|
||||
|
||||
/*!
|
||||
@@ -89,7 +89,7 @@ class binary_reader
|
||||
@param[in] strict whether to expect the input to be consumed completed
|
||||
@param[in] tag_handler how to treat CBOR tags
|
||||
|
||||
@return
|
||||
@return whether parsing was successful
|
||||
*/
|
||||
JSON_HEDLEY_NON_NULL(3)
|
||||
bool sax_parse(const input_format_t format,
|
||||
@@ -119,7 +119,7 @@ class binary_reader
|
||||
break;
|
||||
|
||||
default: // LCOV_EXCL_LINE
|
||||
JSON_ASSERT(false); // LCOV_EXCL_LINE
|
||||
JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE
|
||||
}
|
||||
|
||||
// strict mode: next byte must be EOF
|
||||
@@ -173,7 +173,7 @@ class binary_reader
|
||||
|
||||
/*!
|
||||
@brief Parses a C-style string from the BSON input.
|
||||
@param[in, out] result A reference to the string variable where the read
|
||||
@param[in,out] result A reference to the string variable where the read
|
||||
string is to be stored.
|
||||
@return `true` if the \x00-byte indicating the end of the string was
|
||||
encountered before the EOF; false` indicates an unexpected EOF.
|
||||
@@ -201,7 +201,7 @@ class binary_reader
|
||||
input.
|
||||
@param[in] len The length (including the zero-byte at the end) of the
|
||||
string to be read.
|
||||
@param[in, out] result A reference to the string variable where the read
|
||||
@param[in,out] result A reference to the string variable where the read
|
||||
string is to be stored.
|
||||
@tparam NumberType The type of the length @a len
|
||||
@pre len >= 1
|
||||
@@ -222,7 +222,7 @@ class binary_reader
|
||||
/*!
|
||||
@brief Parses a byte array input of length @a len from the BSON input.
|
||||
@param[in] len The length of the byte array to be read.
|
||||
@param[in, out] result A reference to the binary variable where the read
|
||||
@param[in,out] result A reference to the binary variable where the read
|
||||
array is to be stored.
|
||||
@tparam NumberType The type of the length @a len
|
||||
@pre len >= 0
|
||||
@@ -315,7 +315,7 @@ class binary_reader
|
||||
default: // anything else not supported (yet)
|
||||
{
|
||||
std::array<char, 3> cr{{}};
|
||||
(std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast<unsigned char>(element_type));
|
||||
(std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast<unsigned char>(element_type)); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
||||
return sax->parse_error(element_type_parse_position, std::string(cr.data()), parse_error::create(114, element_type_parse_position, "Unsupported BSON record type 0x" + std::string(cr.data()), BasicJsonType()));
|
||||
}
|
||||
}
|
||||
@@ -754,7 +754,7 @@ class binary_reader
|
||||
}
|
||||
|
||||
default: // LCOV_EXCL_LINE
|
||||
JSON_ASSERT(false); // LCOV_EXCL_LINE
|
||||
JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE
|
||||
return false; // LCOV_EXCL_LINE
|
||||
}
|
||||
}
|
||||
@@ -1854,7 +1854,7 @@ class binary_reader
|
||||
{
|
||||
return false;
|
||||
}
|
||||
result = static_cast<std::size_t>(number);
|
||||
result = static_cast<std::size_t>(number); // NOLINT(bugprone-signed-char-misuse,cert-str34-c): number is not a char
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2211,8 +2211,8 @@ class binary_reader
|
||||
}
|
||||
|
||||
// parse number string
|
||||
auto number_ia = detail::input_adapter(std::forward<decltype(number_vector)>(number_vector));
|
||||
auto number_lexer = detail::lexer<BasicJsonType, decltype(number_ia)>(std::move(number_ia), false);
|
||||
using ia_type = decltype(detail::input_adapter(number_vector));
|
||||
auto number_lexer = detail::lexer<BasicJsonType, ia_type>(detail::input_adapter(number_vector), false);
|
||||
const auto result_number = number_lexer.scan();
|
||||
const auto number_string = number_lexer.get_token_string();
|
||||
const auto result_remainder = number_lexer.scan();
|
||||
@@ -2287,7 +2287,7 @@ class binary_reader
|
||||
bool get_number(const input_format_t format, NumberType& result)
|
||||
{
|
||||
// step 1: read input into array with system's byte order
|
||||
std::array<std::uint8_t, sizeof(NumberType)> vec;
|
||||
std::array<std::uint8_t, sizeof(NumberType)> vec{};
|
||||
for (std::size_t i = 0; i < sizeof(NumberType); ++i)
|
||||
{
|
||||
get();
|
||||
@@ -2400,7 +2400,7 @@ class binary_reader
|
||||
std::string get_token_string() const
|
||||
{
|
||||
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()};
|
||||
}
|
||||
|
||||
@@ -2435,7 +2435,7 @@ class binary_reader
|
||||
break;
|
||||
|
||||
default: // LCOV_EXCL_LINE
|
||||
JSON_ASSERT(false); // LCOV_EXCL_LINE
|
||||
JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE
|
||||
}
|
||||
|
||||
return error_msg + " " + context + ": " + detail;
|
||||
|
||||
Reference in New Issue
Block a user