From 834fb9999bc906693f1abaf257acbddbc57a6f48 Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Mon, 18 Jan 2021 22:00:45 -0800 Subject: [PATCH] Ignore gcc-10 warning (#273) Workaround for GCC 10 null dereference warning. --- include/cxxopts.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/cxxopts.hpp b/include/cxxopts.hpp index 6ec7998..e491b2e 100644 --- a/include/cxxopts.hpp +++ b/include/cxxopts.hpp @@ -1133,12 +1133,21 @@ namespace cxxopts m_value->parse(); } +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Werror=null-dereference" +#endif + CXXOPTS_NODISCARD size_t count() const noexcept { return m_count; } + +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif // TODO: maybe default options should count towards the number of arguments CXXOPTS_NODISCARD