From fc6ac6a39d1bb170fb6ffca50b1ddb7cedfd8d40 Mon Sep 17 00:00:00 2001 From: Florian Albrechtskirchinger Date: Wed, 8 Jun 2022 13:57:01 +0200 Subject: [PATCH] Exclude unreachable lines from coverage Certain lines are unreachable in 64bit builds. --- include/nlohmann/detail/input/binary_reader.hpp | 10 ++++++---- single_include/nlohmann/json.hpp | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/nlohmann/detail/input/binary_reader.hpp b/include/nlohmann/detail/input/binary_reader.hpp index 862c1552a..9332af3e6 100644 --- a/include/nlohmann/detail/input/binary_reader.hpp +++ b/include/nlohmann/detail/input/binary_reader.hpp @@ -2081,8 +2081,9 @@ class binary_reader } if (!value_in_range_of(number)) { - return sax->parse_error(chars_read, get_token_string(), out_of_range::create(408, - exception_message(input_format, "integer value overflow", "size"), nullptr)); + // undo coverage exclusion once the 32bit test is run as part of CI (#3524) + return sax->parse_error(chars_read, get_token_string(), out_of_range::create(408, // LCOV_EXCL_LINE + exception_message(input_format, "integer value overflow", "size"), nullptr)); // LCOV_EXCL_LINE } result = static_cast(number); return true; @@ -2131,8 +2132,9 @@ class binary_reader } if (!value_in_range_of(number)) { - return sax->parse_error(chars_read, get_token_string(), out_of_range::create(408, - exception_message(input_format, "integer value overflow", "size"), nullptr)); + // undo coverage exclusion once the 32bit test is run as part of CI (#3524) + return sax->parse_error(chars_read, get_token_string(), out_of_range::create(408, // LCOV_EXCL_LINE + exception_message(input_format, "integer value overflow", "size"), nullptr)); // LCOV_EXCL_LINE } result = detail::conditional_static_cast(number); return true; diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index da199e31e..3dcd48027 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -10766,8 +10766,9 @@ class binary_reader } if (!value_in_range_of(number)) { - return sax->parse_error(chars_read, get_token_string(), out_of_range::create(408, - exception_message(input_format, "integer value overflow", "size"), nullptr)); + // undo coverage exclusion once the 32bit test is run as part of CI (#3524) + return sax->parse_error(chars_read, get_token_string(), out_of_range::create(408, // LCOV_EXCL_LINE + exception_message(input_format, "integer value overflow", "size"), nullptr)); // LCOV_EXCL_LINE } result = static_cast(number); return true; @@ -10816,8 +10817,9 @@ class binary_reader } if (!value_in_range_of(number)) { - return sax->parse_error(chars_read, get_token_string(), out_of_range::create(408, - exception_message(input_format, "integer value overflow", "size"), nullptr)); + // undo coverage exclusion once the 32bit test is run as part of CI (#3524) + return sax->parse_error(chars_read, get_token_string(), out_of_range::create(408, // LCOV_EXCL_LINE + exception_message(input_format, "integer value overflow", "size"), nullptr)); // LCOV_EXCL_LINE } result = detail::conditional_static_cast(number); return true;