From 068e9b239cf342333464cb1faaa2f4d65da04793 Mon Sep 17 00:00:00 2001 From: Philip Top Date: Sat, 5 Oct 2024 10:31:13 -0700 Subject: [PATCH] add coverage exclusions --- include/CLI/TypeTools.hpp | 8 ++++++++ include/CLI/impl/App_inl.hpp | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/include/CLI/TypeTools.hpp b/include/CLI/TypeTools.hpp index 5c2e5f0e2..428b98da9 100644 --- a/include/CLI/TypeTools.hpp +++ b/include/CLI/TypeTools.hpp @@ -915,6 +915,9 @@ bool integral_conversion(const std::string &input, T &output) noexcept { return (val == (input.c_str() + input.size()) && static_cast(output) == output_ll); } if(input.compare(0, 2, "0b") == 0 || input.compare(0, 2, "0B") == 0) { + // LCOV_EXCL_START + // In some new compilers including the coverage testing one binary strings are handled properly in strtoull automatically + // so this coverage is missing but is well tested in other compilers val = nullptr; errno = 0; output_ll = std::strtoull(input.c_str() + 2, &val, 2); @@ -923,6 +926,7 @@ bool integral_conversion(const std::string &input, T &output) noexcept { } output = static_cast(output_ll); return (val == (input.c_str() + input.size()) && static_cast(output) == output_ll); + // LCOV_EXCL_STOP } return false; } @@ -966,6 +970,9 @@ bool integral_conversion(const std::string &input, T &output) noexcept { return (val == (input.c_str() + input.size()) && static_cast(output) == output_ll); } if(input.compare(0, 2, "0b") == 0 || input.compare(0, 2, "0B") == 0) { + // LCOV_EXCL_START + // In some new compilers including the coverage testing one binary strings are handled properly in strtoll automatically + // so this coverage is missing but is well tested in other compilers val = nullptr; errno = 0; output_ll = std::strtoll(input.c_str() + 2, &val, 2); @@ -974,6 +981,7 @@ bool integral_conversion(const std::string &input, T &output) noexcept { } output = static_cast(output_ll); return (val == (input.c_str() + input.size()) && static_cast(output) == output_ll); + // LCOV_EXCL_STOP } return false; } diff --git a/include/CLI/impl/App_inl.hpp b/include/CLI/impl/App_inl.hpp index 12b095a2c..cf3b4ca79 100644 --- a/include/CLI/impl/App_inl.hpp +++ b/include/CLI/impl/App_inl.hpp @@ -2265,11 +2265,14 @@ CLI11_INLINE void retire_option(App *app, Option *opt) { ->expected(option_copy->get_expected_min(), option_copy->get_expected_max()) ->allow_extra_args(option_copy->get_allow_extra_args()); + // LCOV_EXCL_START + // something odd with coverage on new compilers Validator retired_warning{[opt2](std::string &) { std::cout << "WARNING " << opt2->get_name() << " is retired and has no effect\n"; return std::string(); }, ""}; + // LCOV_EXCL_STOP retired_warning.application_index(0); opt2->check(retired_warning); } @@ -2287,11 +2290,14 @@ CLI11_INLINE void retire_option(App *app, const std::string &option_name) { ->type_name("RETIRED") ->expected(0, 1) ->default_str("RETIRED"); + // LCOV_EXCL_START + // something odd with coverage on new compilers Validator retired_warning{[opt2](std::string &) { std::cout << "WARNING " << opt2->get_name() << " is retired and has no effect\n"; return std::string(); }, ""}; + //LCOV_EXCL_STOP retired_warning.application_index(0); opt2->check(retired_warning); }