From: Nathan Chancellor <nathan@kernel.org>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: linux-bcachefs@vger.kernel.org, llvm@lists.linux.dev,
patches@lists.linux.dev, Nathan Chancellor <nathan@kernel.org>
Subject: [PATCH] bcachefs: Fix -Wc23-extensions in bch2_check_dirents()
Date: Wed, 04 Jun 2025 12:38:27 -0700 [thread overview]
Message-ID: <20250604-bcachefs-fix-clang-label-followed-by-declaration-v1-1-68a8bce1d981@kernel.org> (raw)
Clang warns (or errors with CONFIG_WERROR=y):
fs/bcachefs/fsck.c:2325:2: error: label followed by a declaration is a C23 extension [-Werror,-Wc23-extensions]
2325 | int ret = bch2_trans_run(c,
| ^
On clang-17 and older, this is an unconditional error:
fs/bcachefs/fsck.c:2325:2: error: expected expression
2325 | int ret = bch2_trans_run(c,
| ^
Move the declaration of ret to the top of the function to resolve both
ways this issue manifests.
Fixes: c72def523799 ("bcachefs: Run check_dirents second time if required")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
fs/bcachefs/fsck.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c
index 40d6110c3671..68ed69a255e1 100644
--- a/fs/bcachefs/fsck.c
+++ b/fs/bcachefs/fsck.c
@@ -2319,10 +2319,11 @@ int bch2_check_dirents(struct bch_fs *c)
struct snapshots_seen s;
struct bch_hash_info hash_info;
bool need_second_pass = false, did_second_pass = false;
+ int ret;
snapshots_seen_init(&s);
again:
- int ret = bch2_trans_run(c,
+ ret = bch2_trans_run(c,
for_each_btree_key_commit(trans, iter, BTREE_ID_dirents,
POS(BCACHEFS_ROOT_INO, 0),
BTREE_ITER_prefetch|BTREE_ITER_all_snapshots, k,
---
base-commit: c1af8a9222e641dbcb722a1d033f6aed4fbcfc34
change-id: 20250604-bcachefs-fix-clang-label-followed-by-declaration-faca94ac08dd
Best regards,
--
Nathan Chancellor <nathan@kernel.org>
reply other threads:[~2025-06-04 19:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20250604-bcachefs-fix-clang-label-followed-by-declaration-v1-1-68a8bce1d981@kernel.org \
--to=nathan@kernel.org \
--cc=kent.overstreet@linux.dev \
--cc=linux-bcachefs@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).