From 3aee89c8fd97123f8c793cbb0de1428de6a304f2 Mon Sep 17 00:00:00 2001 From: Ryan Sherlock Date: Fri, 19 Mar 2021 15:57:06 +0000 Subject: [PATCH 1/2] add default cases Adding default case for cases where the compilation flag -Wswitch-default is present on the command line when spdlog is included in external projects. Signed-off-by: Ryan Sherlock --- include/spdlog/fmt/bundled/core.h | 2 ++ include/spdlog/fmt/bundled/format.h | 4 ++++ include/spdlog/sinks/ansicolor_sink-inl.h | 2 ++ 3 files changed, 8 insertions(+) diff --git a/include/spdlog/fmt/bundled/core.h b/include/spdlog/fmt/bundled/core.h index 0a81e0cc..e22b2ed7 100644 --- a/include/spdlog/fmt/bundled/core.h +++ b/include/spdlog/fmt/bundled/core.h @@ -1350,6 +1350,8 @@ FMT_CONSTEXPR_DECL FMT_INLINE auto visit_format_arg( return vis(arg.value_.pointer); case detail::type::custom_type: return vis(typename basic_format_arg::handle(arg.value_.custom)); + default: + break; } return vis(monostate()); } diff --git a/include/spdlog/fmt/bundled/format.h b/include/spdlog/fmt/bundled/format.h index 1a037b02..864c6bae 100644 --- a/include/spdlog/fmt/bundled/format.h +++ b/include/spdlog/fmt/bundled/format.h @@ -2814,6 +2814,8 @@ FMT_CONSTEXPR const Char* parse_align(const Char* begin, const Char* end, case '^': align = align::center; break; + default: + break; } if (align != align::none) { if (p != begin) { @@ -2897,6 +2899,8 @@ FMT_CONSTEXPR const Char* parse_format_specs(const Char* begin, const Char* end, handler.on_space(); ++begin; break; + default: + break; } if (begin == end) return begin; diff --git a/include/spdlog/sinks/ansicolor_sink-inl.h b/include/spdlog/sinks/ansicolor_sink-inl.h index 3d5071d9..61c0a719 100644 --- a/include/spdlog/sinks/ansicolor_sink-inl.h +++ b/include/spdlog/sinks/ansicolor_sink-inl.h @@ -106,6 +106,8 @@ SPDLOG_INLINE void ansicolor_sink::set_color_mode(color_mode mode) case color_mode::never: should_do_colors_ = false; return; + default: + should_do_colors_ = false; } } From bb5e1ee2f92d830a66d4644b85ec8fc211bf13b9 Mon Sep 17 00:00:00 2001 From: Ryan Sherlock Date: Sat, 20 Mar 2021 09:22:40 -0700 Subject: [PATCH 2/2] Removing changes to bundled fmt Removing changes to the bundled fmt library. The default case statements will be changed in the upstream library. Signed-off-by: Ryan Sherlock --- include/spdlog/fmt/bundled/core.h | 2 -- include/spdlog/fmt/bundled/format.h | 4 ---- 2 files changed, 6 deletions(-) diff --git a/include/spdlog/fmt/bundled/core.h b/include/spdlog/fmt/bundled/core.h index e22b2ed7..0a81e0cc 100644 --- a/include/spdlog/fmt/bundled/core.h +++ b/include/spdlog/fmt/bundled/core.h @@ -1350,8 +1350,6 @@ FMT_CONSTEXPR_DECL FMT_INLINE auto visit_format_arg( return vis(arg.value_.pointer); case detail::type::custom_type: return vis(typename basic_format_arg::handle(arg.value_.custom)); - default: - break; } return vis(monostate()); } diff --git a/include/spdlog/fmt/bundled/format.h b/include/spdlog/fmt/bundled/format.h index 864c6bae..1a037b02 100644 --- a/include/spdlog/fmt/bundled/format.h +++ b/include/spdlog/fmt/bundled/format.h @@ -2814,8 +2814,6 @@ FMT_CONSTEXPR const Char* parse_align(const Char* begin, const Char* end, case '^': align = align::center; break; - default: - break; } if (align != align::none) { if (p != begin) { @@ -2899,8 +2897,6 @@ FMT_CONSTEXPR const Char* parse_format_specs(const Char* begin, const Char* end, handler.on_space(); ++begin; break; - default: - break; } if (begin == end) return begin;