All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: "Liam R. Howlett" <Liam.Howlett@oracle.com>
Cc: linux-mm@kvack.org, llvm@lists.linux.dev,
	patches@lists.linux.dev, Nathan Chancellor <nathan@kernel.org>
Subject: [PATCH] lib/maple_tree: Fix clang -Wimplicit-fallthrough in mte_set_pivot()
Date: Thu, 24 Feb 2022 09:17:05 -0700	[thread overview]
Message-ID: <20220224161705.1937458-1-nathan@kernel.org> (raw)

Clang warns:

  lib/maple_tree.c:764:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
          case maple_dense:
          ^
  lib/maple_tree.c:764:2: note: insert 'break;' to avoid fall-through
          case maple_dense:
          ^
          break;
  1 error generated.

Clang is a little more pedantic than GCC, which does not warn when
falling through to a case that is just break or return. Clang's version
is more in line with the kernel's own stance in deprecated.rst, which
states that all switch/case blocks must end in either break,
fallthrough, continue, goto, or return. Add the missing break to silence
the warning.

Link: https://github.com/ClangBuiltLinux/linux/issues/1604
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 lib/maple_tree.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 5132495f86a6..5d8c39cbd517 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -761,6 +761,7 @@ static inline void mte_set_pivot(struct maple_enode *mn, unsigned char piv,
 		break;
 	case maple_arange_64:
 		(&node->ma64)->pivot[piv] = val;
+		break;
 	case maple_dense:
 		break;
 	}

base-commit: 7ec16b08f9e0b656c96d20424b1cbbff4c78329c
-- 
2.35.1


             reply	other threads:[~2022-02-24 16:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-24 16:17 Nathan Chancellor [this message]
2022-02-24 17:40 ` [PATCH] lib/maple_tree: Fix clang -Wimplicit-fallthrough in mte_set_pivot() Liam Howlett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220224161705.1937458-1-nathan@kernel.org \
    --to=nathan@kernel.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=llvm@lists.linux.dev \
    --cc=patches@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.