lkml.org 
[lkml]   [2019]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] clk: samsung: s3c2443: Mark expected switch fall-through
On Mon, 11 Feb 2019 at 19:40, Gustavo A. R. Silva
<gustavo@embeddedor.com> wrote:
>
> In preparation to enabling -Wimplicit-fallthrough, mark switch
> cases where we are expecting to fall through.
>
> This patch fixes the following warnings:
>
> drivers/clk/samsung/clk-s3c2443.c: In function ‘s3c2443_common_clk_init’:
> drivers/clk/samsung/clk-s3c2443.c:390:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
> samsung_clk_register_alias(ctx, s3c2450_aliases,
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ARRAY_SIZE(s3c2450_aliases));
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/clk/samsung/clk-s3c2443.c:393:2: note: here
> case S3C2416:
> ^~~~
>
> Warning level 3 was used: -Wimplicit-fallthrough=3
>
> Notice that, in this particular case, the code comment is modified
> in accordance with what GCC is expecting to find.
>
> This patch is part of the ongoing efforts to enable
> -Wimplicit-fallthrough.

I saw this in multiple places already and I think fix is wrong. The
point is that the code is correct - the fall through is marked
properly.

It is just the GCC which has to be fixed not the code. You want to
adjust the code for specific version of GCC and what if GCC changes
its warning? For example GCC might require "fall through: "... or any
other syntax. Another point - what about clang's syntax?

Best regards,
Krzysztof

\
 
 \ /
  Last update: 2019-02-12 08:42    [W:0.088 / U:0.360 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site