From 427062c752fee17caa00ed0a83fe1ecbdbad40d2 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Sun, 19 Jun 2022 14:24:50 +0200 Subject: [PATCH] refactor: Use [[fallthrough]] attribute --- src/Args.cpp | 4 ++-- src/Util.cpp | 8 ++++---- src/Win32Util.cpp | 8 +++++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Args.cpp b/src/Args.cpp index f8796e0e9..9b1dfbd1e 100644 --- a/src/Args.cpp +++ b/src/Args.cpp @@ -87,7 +87,7 @@ Args::from_atfile(const std::string& filename, AtFileFormat format) if (format == AtFileFormat::msvc) { break; } - // Fall through. + [[fallthrough]]; case '"': if (quoting != '\0') { @@ -111,7 +111,7 @@ Args::from_atfile(const std::string& filename, AtFileFormat format) if (quoting) { break; } - // Fall through. + [[fallthrough]]; case '\0': // End of token diff --git a/src/Util.cpp b/src/Util.cpp index ebb69bf18..089198ca8 100644 --- a/src/Util.cpp +++ b/src/Util.cpp @@ -1059,13 +1059,13 @@ parse_size(const std::string& value) switch (*p) { case 'T': result *= multiplier; - // Fallthrough. + [[fallthrough]]; case 'G': result *= multiplier; - // Fallthrough. + [[fallthrough]]; case 'M': result *= multiplier; - // Fallthrough. + [[fallthrough]]; case 'K': case 'k': result *= multiplier; @@ -1270,7 +1270,7 @@ send_to_fd(const Context& ctx, const std::string& text, int fd) modified_text = strip_ansi_csi_seqs(text); text_to_send = &modified_text; } catch (const core::Error&) { - // Fall through + // Ignore. } } diff --git a/src/Win32Util.cpp b/src/Win32Util.cpp index e677107b7..92d1ffb58 100644 --- a/src/Win32Util.cpp +++ b/src/Win32Util.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2020-2021 Joel Rosdahl and other contributors +// Copyright (C) 2020-2022 Joel Rosdahl and other contributors // // See doc/AUTHORS.adoc for a complete list of contributors. // @@ -97,10 +97,12 @@ argv_to_string(const char* const* argv, ++bs; break; } - // Fallthrough. + [[fallthrough]]; + case '"': bs = (bs << 1) + 1; - // Fallthrough. + [[fallthrough]]; + default: while (bs > 0) { result += '\\'; -- 2.47.3