Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jarro2783/cxxopts.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarryd Beck <jarro.2783@gmail.com>2021-06-01 01:09:56 +0300
committerJarryd Beck <jarro.2783@gmail.com>2021-06-01 01:09:56 +0300
commitb512c828e516aac1420d36d643d8d20cc809dc8a (patch)
tree7f6594878889a09c58e9a7a9f10c6fcdb0504d79
parent97a4d5511ffefc81a97abd3d67b37f66e57655ee (diff)
Fix GCC version check for null deref
-rw-r--r--include/cxxopts.hpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/cxxopts.hpp b/include/cxxopts.hpp
index 1862c8b..734505d 100644
--- a/include/cxxopts.hpp
+++ b/include/cxxopts.hpp
@@ -70,6 +70,10 @@ THE SOFTWARE.
#define CXXOPTS__VERSION_MINOR 0
#define CXXOPTS__VERSION_PATCH 0
+#if __GNUC__ < 10 || (__GNUC__ == 10 && __GNUC_MINOR__ <= 1)
+ #define CXXOPTS_SKIP_NULL_DEREF
+#endif
+
namespace cxxopts
{
static constexpr struct {
@@ -1386,12 +1390,10 @@ namespace cxxopts
m_long_name = &details->long_name();
}
-#if defined(__GNUC__)
-#if __GNUC__ <= 10 && __GNUC_MINOR__ <= 1
+#if defined(CXXOPTS_SKIP_NULL_DEREF)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Werror=null-dereference"
#endif
-#endif
CXXOPTS_NODISCARD
size_t
@@ -1400,11 +1402,9 @@ namespace cxxopts
return m_count;
}
-#if defined(__GNUC__)
-#if __GNUC__ <= 10 && __GNUC_MINOR__ <= 1
+#if defined(CXXOPTS_SKIP_NULL_DEREF)
#pragma GCC diagnostic pop
#endif
-#endif
// TODO: maybe default options should count towards the number of arguments
CXXOPTS_NODISCARD