linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] ring-buffer: Fix fall-through warning for Clang
@ 2021-05-28 19:59 Gustavo A. R. Silva
  2021-05-28 20:08 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Gustavo A. R. Silva @ 2021-05-28 19:59 UTC (permalink / raw)
  To: Steven Rostedt, Ingo Molnar
  Cc: linux-kernel, Gustavo A. R. Silva, linux-hardening

In preparation to enable -Wimplicit-fallthrough for Clang, fix
a fall-through warning by replacing a /* fall through */ comment
with the new pseudo-keyword macro fallthrough;

Notice that Clang doesn't recognize /* fall through */ comments as
implicit fall-through markings, so in order to globally enable
-Wimplicit-fallthrough for Clang, these comments need to be
replaced with fallthrough; in the whole codebase.

Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
JFYI: We had thousands of these sorts of warnings and now we are down
      to just 25 in linux-next. This is one of those last remaining
      warnings.

 kernel/trace/ring_buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 2c0ee6484990..d1463eac11a3 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -3391,7 +3391,7 @@ static void check_buffer(struct ring_buffer_per_cpu *cpu_buffer,
 		case RINGBUF_TYPE_PADDING:
 			if (event->time_delta == 1)
 				break;
-			/* fall through */
+			fallthrough;
 		case RINGBUF_TYPE_DATA:
 			ts += event->time_delta;
 			break;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH][next] ring-buffer: Fix fall-through warning for Clang
  2021-05-28 19:59 [PATCH][next] ring-buffer: Fix fall-through warning for Clang Gustavo A. R. Silva
@ 2021-05-28 20:08 ` Steven Rostedt
  2021-05-28 20:13   ` Gustavo A. R. Silva
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2021-05-28 20:08 UTC (permalink / raw)
  To: Gustavo A. R. Silva; +Cc: Ingo Molnar, linux-kernel, linux-hardening

On Fri, 28 May 2021 14:59:42 -0500
"Gustavo A. R. Silva" <gustavoars@kernel.org> wrote:

> In preparation to enable -Wimplicit-fallthrough for Clang, fix
> a fall-through warning by replacing a /* fall through */ comment
> with the new pseudo-keyword macro fallthrough;
> 
> Notice that Clang doesn't recognize /* fall through */ comments as
> implicit fall-through markings, so in order to globally enable
> -Wimplicit-fallthrough for Clang, these comments need to be
> replaced with fallthrough; in the whole codebase.
> 
> Link: https://github.com/KSPP/linux/issues/115
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
> JFYI: We had thousands of these sorts of warnings and now we are down
>       to just 25 in linux-next. This is one of those last remaining
>       warnings.

And I have it fixed locally already.

  https://lore.kernel.org/lkml/20210511140246.18868-1-jj251510319013@gmail.com/

I've just been on vacation and haven't pushed it to next yet. It's still in
the "to be tested" queue.

-- Steve

> 
>  kernel/trace/ring_buffer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
> index 2c0ee6484990..d1463eac11a3 100644
> --- a/kernel/trace/ring_buffer.c
> +++ b/kernel/trace/ring_buffer.c
> @@ -3391,7 +3391,7 @@ static void check_buffer(struct ring_buffer_per_cpu *cpu_buffer,
>  		case RINGBUF_TYPE_PADDING:
>  			if (event->time_delta == 1)
>  				break;
> -			/* fall through */
> +			fallthrough;
>  		case RINGBUF_TYPE_DATA:
>  			ts += event->time_delta;
>  			break;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][next] ring-buffer: Fix fall-through warning for Clang
  2021-05-28 20:08 ` Steven Rostedt
@ 2021-05-28 20:13   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2021-05-28 20:13 UTC (permalink / raw)
  To: Steven Rostedt, Gustavo A. R. Silva
  Cc: Ingo Molnar, linux-kernel, linux-hardening



On 5/28/21 15:08, Steven Rostedt wrote:
> On Fri, 28 May 2021 14:59:42 -0500
> "Gustavo A. R. Silva" <gustavoars@kernel.org> wrote:
> 
>> In preparation to enable -Wimplicit-fallthrough for Clang, fix
>> a fall-through warning by replacing a /* fall through */ comment
>> with the new pseudo-keyword macro fallthrough;
>>
>> Notice that Clang doesn't recognize /* fall through */ comments as
>> implicit fall-through markings, so in order to globally enable
>> -Wimplicit-fallthrough for Clang, these comments need to be
>> replaced with fallthrough; in the whole codebase.
>>
>> Link: https://github.com/KSPP/linux/issues/115
>> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
>> ---
>> JFYI: We had thousands of these sorts of warnings and now we are down
>>       to just 25 in linux-next. This is one of those last remaining
>>       warnings.
> 
> And I have it fixed locally already.
> 
>   https://lore.kernel.org/lkml/20210511140246.18868-1-jj251510319013@gmail.com/
> 
> I've just been on vacation and haven't pushed it to next yet. It's still in
> the "to be tested" queue.

Awesome! :)

Thanks, Steven.
--
Gustavo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-28 20:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-28 19:59 [PATCH][next] ring-buffer: Fix fall-through warning for Clang Gustavo A. R. Silva
2021-05-28 20:08 ` Steven Rostedt
2021-05-28 20:13   ` Gustavo A. R. Silva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).