Re: [GIT PULL] Char/Misc driver changes for 6.9-rc1

From: Linus Torvalds
Date: Thu Mar 21 2024 - 14:10:48 EST


On Thu, 21 Mar 2024 at 06:48, Nathan Chancellor <nathan@xxxxxxxxxx> wrote:
>
> That build warning actually happens with clang, not GCC as far as I am
> aware, and it is actually a hard build error with older versions of
> clang

So the "labels without a statement" thing is not only a long-time gcc
behavior (admittedly due to a parsing bug), afaik it's becoming
"standard C" in C23.

Does clang have a flag to allow this?

Considering that gcc doesn't warn for it, and that it will become
official at some point anyway, I think this might be a thing that we
might be better off just accepting, rather than be in the situation
where people write code that compiles fine with gcc and don't notice
that clang will error out.

So yes, clang is being correct, but in this case it only causes problems.

Linus