From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: fallthrough question
Date: Fri, 18 Feb 2022 17:15:16 -0600 [thread overview]
Message-ID: <20220218231516.GA1091555@embeddedor> (raw)
In-Reply-To: <858a2b13-64e1-99bc-e2f7-5b2477bb1126@infradead.org>
Hi there,
On Fri, Feb 18, 2022 at 01:57:58PM -0800, Randy Dunlap wrote:
> Hi,
>
> I expected this to produce a fallthrough warning, but it doesn't
> (with gcc 11.1.0):
>
> from sound/oss/dmasound/dmasound_core.c:#1481, when falling from case 1
> into case 0: (in arch/m68k/ selected builds only)
>
> case 1:
> if ((size = ints[2]) < 256) /* check for small buffer specs */
> size <<= 10 ;
> if (size < MIN_BUFSIZE || size > MAX_BUFSIZE)
> printk("dmasound_setup: invalid write buffer size, using default = %d\n", writeBufSize);
> else
> writeBufSize = size;
> case 0:
> break;
> default:
>
> Can you tell me what is going on here?
As you can see the warning is suppressed when a case label falls through to
a case that merely breaks... or returns, or continues (continue statement)
or that goes to (goto statement) some other place.
However, Clang disagrees with this. See below for more:
https://github.com/ClangBuiltLinux/linux/issues/636
https://godbolt.org/z/xgkvIh
--
Gustavo
next prev parent reply other threads:[~2022-02-18 23:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-18 21:57 fallthrough question Randy Dunlap
2022-02-18 23:15 ` Gustavo A. R. Silva [this message]
2022-02-18 23:41 ` Randy Dunlap
2022-02-19 11:08 ` Joe Perches
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=20220218231516.GA1091555@embeddedor \
--to=gustavoars@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@infradead.org \
/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.