Commit 834fb9999bc906693f1abaf257acbddbc57a6f48

Authored by Benjamin Sergeant
Committed by GitHub
1 parent dc9a7728

Ignore gcc-10 warning (#273)

Workaround for GCC 10 null dereference warning.
Showing 1 changed file with 9 additions and 0 deletions
include/cxxopts.hpp
@@ -1133,12 +1133,21 @@ namespace cxxopts @@ -1133,12 +1133,21 @@ namespace cxxopts
1133 m_value->parse(); 1133 m_value->parse();
1134 } 1134 }
1135 1135
  1136 +#if defined(__GNUC__)
  1137 +#pragma GCC diagnostic push
  1138 +#pragma GCC diagnostic ignored "-Werror=null-dereference"
  1139 +#endif
  1140 +
1136 CXXOPTS_NODISCARD 1141 CXXOPTS_NODISCARD
1137 size_t 1142 size_t
1138 count() const noexcept 1143 count() const noexcept
1139 { 1144 {
1140 return m_count; 1145 return m_count;
1141 } 1146 }
  1147 +
  1148 +#if defined(__GNUC__)
  1149 +#pragma GCC diagnostic pop
  1150 +#endif
1142 1151
1143 // TODO: maybe default options should count towards the number of arguments 1152 // TODO: maybe default options should count towards the number of arguments
1144 CXXOPTS_NODISCARD 1153 CXXOPTS_NODISCARD