Re: [GIT PULL] bcachefs fixes for 6.11-rc6

From: Nathan Chancellor
Date: Tue Sep 03 2024 - 13:17:21 EST


On Tue, Sep 03, 2024 at 03:53:56PM +0200, Geert Uytterhoeven wrote:
> Hi Kent,
>
> Replying here, as there is (again) no patch email to reply to to report issues.
>
> noreply@xxxxxxxxxxxxxx is reporting several build failures[1] in linux-next:
>
> fs/bcachefs/sb-members.c: In function ‘bch2_sb_member_alloc’:
> fs/bcachefs/sb-members.c:503:2: error: a label can only be part of
> a statement and a declaration is not a statement
> 503 | unsigned nr_devices = max_t(unsigned, dev_idx + 1,
> c->sb.nr_devices);
> | ^~~~~~~~
> fs/bcachefs/sb-members.c:505:2: error: expected expression before ‘struct’
> 505 | struct bch_sb_field_members_v2 *mi =
> bch2_sb_field_get(c->disk_sb.sb, members_v2);
> | ^~~~~~
>
> Apparently this fails with gcc-10 and older, but builds with gcc-11
> and gcc-12.

Just noting this also happens with clang. Depending on the version, it
is either a hard error like this or a warning (that gets upgraded to an
error with CONFIG_WERROR).

Clang 15:

fs/bcachefs/sb-members.c:503:2: error: expected expression
unsigned nr_devices = max_t(unsigned, dev_idx + 1, c->sb.nr_devices);
^
fs/bcachefs/sb-members.c:507:42: error: use of undeclared identifier 'nr_devices'
le16_to_cpu(mi->member_bytes) * nr_devices, sizeof(u64));
^
include/linux/math.h:37:22: note: expanded from macro 'DIV_ROUND_UP'
#define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP
^
fs/bcachefs/sb-members.c:513:30: error: use of undeclared identifier 'nr_devices'
c->disk_sb.sb->nr_devices = nr_devices;
^

Clang 19:

fs/bcachefs/sb-members.c:503:2: error: label followed by a declaration is a C23 extension [-Werror,-Wc23-extensions]
503 | unsigned nr_devices = max_t(unsigned, dev_idx + 1, c->sb.nr_devices);
| ^

Cheers,
Nathan