From 90b318105fc820a949cd2d923bb47a00a127766b Mon Sep 17 00:00:00 2001 From: Jarryd Beck Date: Thu, 15 Jun 2023 07:01:07 +1000 Subject: [PATCH] Fix unannoted fallthrough Fixes #402. --- include/cxxopts.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/cxxopts.hpp b/include/cxxopts.hpp index 212fe8e..062c17c 100644 --- a/include/cxxopts.hpp +++ b/include/cxxopts.hpp @@ -73,6 +73,14 @@ THE SOFTWARE. # endif #endif +#define CXXOPTS_FALLTHROUGH +#ifdef __has_cpp_attribute + #if __has_cpp_attribute(fallthrough) + #undef CXXOPTS_FALLTHROUGH + #define CXXOPTS_FALLTHROUGH [[fallthrough]] + #endif +#endif + #if __cplusplus >= 201603L #define CXXOPTS_NODISCARD [[nodiscard]] #else @@ -2239,6 +2247,7 @@ OptionAdder::operator() case 1: short_name = *first_short_name_iter; option_names.erase(first_short_name_iter); + CXXOPTS_FALLTHROUGH; case 0: break; default: