[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHk-=wi0ePNgwLfk8yddABjnZh+gcL9dV2E8mxLKfb=8LHFQ-g@mail.gmail.com>
Date: Fri, 6 Sep 2024 17:48:09 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Nathan Chancellor <nathan@...nel.org>
Cc: Paolo Bonzini <pbonzini@...hat.com>, linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
llvm@...ts.linux.dev
Subject: Re: [GIT PULL] KVM fixes for Linux 6.11-rc7
On Fri, 6 Sept 2024 at 16:40, Nathan Chancellor <nathan@...nel.org> wrote:
>
> This was brought up to GCC at one point and they considered its current
> behavior as working as intended from my understanding:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91432
Their argument seems to be "the missing fallthrough has no effect".
Which is true.
But they seem to be missing that it has no effect *NOW*.
One major problem case is that people tend to add new cases to the end
of a switch() statement, not counting that final "default: break".
So the "it doesn't have any effect NOW" is true, but the next time
somebody edits that and doesn't check warnings, it *will* have very
strange behavior, and it won't be affecting the newly added case, but
some entirely unrelated previous case.
So I really think the lack of warnings is a gcc mis-feature. It leaves
code in a bad situation going forward.
Oh well. Many times I have had to disable warnings entirely because
they have too many false positives, so I guess the occasional "doesn't
warn enough" is still a better problem to have.
And at least we have (a) clang warning about it and (b) require the
warnings going forward and use -Werror, so at least for the kernel the
"when somebody edits that code, you get surprising behavior" case
_will_ get noticed.
Linus
Powered by blists - more mailing lists