[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2daf8fd4-0789-fdf0-c38c-2237c0a8d9f3@infradead.org>
Date: Fri, 18 Feb 2022 15:41:26 -0800
From: Randy Dunlap <rdunlap@...radead.org>
To: "Gustavo A. R. Silva" <gustavoars@...nel.org>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: fallthrough question
On 2/18/22 15:15, Gustavo A. R. Silva wrote:
> 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
I see. Thank you.
--
~Randy
Powered by blists - more mailing lists