Skip to contentSkip to conversation

fallthrough fixes for Clang for 5.14-rc1

GIT PULL Merged Gustavo A. R. Silva 4 participants 4 messages Jun 28, 2021 – Jun 29, 2021

lore
Share & tools
lore
#0 lore raw

The following changes since commit d07f6ca923ea0927a1024dfccafc5b53b61cfecc:

Linux 5.13-rc2 (2021-05-16 15:27:44 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git tags/fallthrough-fixes-clang-5.14-rc1

for you to fetch changes up to 40e67c120093a918037b6ec589bafd5d96b522a3:

rxrpc: Fix fall-through warnings for Clang (2021-06-04 17:40:04 -0500)

----------------------------------------------------------------
fallthrough fixes for Clang for 5.14-rc1

Hi Linus,

Please, pull the following patches that fix many fall-through warnings when building with Clang 12.0.0 and this[1] change reverted. Notice that in order to enable -Wimplicit-fallthrough for Clang, such change[1] is meant to be reverted at some point. So, these patches help to move in that direction.

Thanks!

[1] commit e2079e93f562c ("kbuild: Do not enable -Wimplicit-fallthrough for clang for now")

----------------------------------------------------------------
Gustavo A. R. Silva (26):
tee: Fix fall-through warnings for Clang
atm: fore200e: Fix fall-through warnings for Clang
watchdog: Fix fall-through warnings for Clang
vxge: Fix fall-through warnings for Clang
reiserfs: Fix fall-through warnings for Clang
nfp: Fix fall-through warnings for Clang
netxen_nic: Fix fall-through warnings for Clang
bnxt_en: Fix fall-through warnings for Clang
qlcnic: Fix fall-through warnings for Clang
ipv4: Fix fall-through warnings for Clang
braille_console: Fix fall-through warnings for Clang
firewire: core: Fix fall-through warnings for Clang
hwmon: (corsair-cpro) Fix fall-through warnings for Clang
hwmon: (max6621) Fix fall-through warnings for Clang
ide: Fix fall-through warnings for Clang
net: netrom: Fix fall-through warnings for Clang net/packet: Fix fall-through warnings for Clang
rds: Fix fall-through warnings for Clang
sctp: Fix fall-through warnings for Clang
tipc: Fix fall-through warnings for Clang
xfrm: Fix fall-through warnings for Clang
xfs: Fix fall-through warnings for Clang drm/nouveau: Fix fall-through warnings for Clang drm/nouveau/therm: Fix fall-through warnings for Clang drm/nouveau/clk: Fix fall-through warnings for Clang
rxrpc: Fix fall-through warnings for Clang

 drivers/accessibility/braille/braille_console.c      | 1 +
 drivers/atm/fore200e.c                               | 1 +
 drivers/firewire/core-topology.c                     | 1 +
 drivers/gpu/drm/nouveau/nouveau_bo.c                 | 1 +
 drivers/gpu/drm/nouveau/nouveau_connector.c          | 1 +
 drivers/gpu/drm/nouveau/nvkm/subdev/clk/nv50.c       | 1 +
 drivers/gpu/drm/nouveau/nvkm/subdev/therm/gf119.c    | 1 +
 drivers/hwmon/corsair-cpro.c                         | 1 +
 drivers/hwmon/max6621.c                              | 2 +-
 drivers/ide/siimage.c                                | 1 +
 drivers/net/ethernet/broadcom/bnxt/bnxt.c            | 1 +
 drivers/net/ethernet/neterion/vxge/vxge-config.c     | 1 +
 drivers/net/ethernet/netronome/nfp/nfp_net_repr.c    | 1 +
 drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c | 1 +
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c       | 1 +
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c     | 1 +
 drivers/tee/tee_core.c                               | 1 +
 drivers/watchdog/machzwd.c                           | 1 +
 fs/reiserfs/namei.c                                  | 1 +
 fs/xfs/libxfs/xfs_ag_resv.c                          | 4 ++--
 fs/xfs/libxfs/xfs_alloc.c                            | 2 +-
 fs/xfs/libxfs/xfs_da_btree.c                         | 2 +-
 fs/xfs/scrub/agheader.c                              | 1 +
 fs/xfs/scrub/bmap.c                                  | 2 +-
 fs/xfs/scrub/btree.c                                 | 2 +-
 fs/xfs/scrub/common.c                                | 6 +++---
 fs/xfs/scrub/dabtree.c                               | 2 +-
 fs/xfs/scrub/repair.c                                | 2 +-
 fs/xfs/xfs_bmap_util.c                               | 2 +-
 fs/xfs/xfs_export.c                                  | 4 ++--
 fs/xfs/xfs_file.c                                    | 2 +-
 fs/xfs/xfs_inode.c                                   | 2 +-
 fs/xfs/xfs_ioctl.c                                   | 4 ++--
 fs/xfs/xfs_iomap.c                                   | 2 +-
 fs/xfs/xfs_log.c                                     | 1 +
 fs/xfs/xfs_trans_buf.c                               | 2 +-
 net/ipv4/ah4.c                                       | 1 +
 net/ipv4/esp4.c                                      | 1 +
 net/ipv4/fib_semantics.c                             | 1 +
 net/ipv4/ip_vti.c                                    | 1 +
 net/ipv4/ipcomp.c                                    | 1 +
 net/netrom/nr_route.c                                | 4 ++++
 net/packet/af_packet.c                               | 1 +
 net/rds/tcp_connect.c                                | 1 +
 net/rds/threads.c                                    | 2 ++
 net/rxrpc/af_rxrpc.c                                 | 1 +
 net/sctp/input.c                                     | 3 ++-
 net/tipc/link.c                                      | 1 +
 net/xfrm/xfrm_interface.c                            | 1 +
 49 files changed, 59 insertions(+), 22 deletions(-)
#1 lore raw
Quoted 6 lines · Gustavo A. R. Silva

Please, pull the following patches that fix many fall-through warnings when building with Clang 12.0.0 and this[1] change reverted. Notice that in order to enable -Wimplicit-fallthrough for Clang, such change[1] is meant to be reverted at some point. So, these patches help to move in that direction.

I've pulled this, but I really don't like how random it is.

Just as an example - and there are many others - look at the patch to net/netrom/nr_route.c.

It does

                case 0:
                        nr_node->routes[0] = nr_node->routes[1];
                        fallthrough;
                case 1:
                        nr_node->routes[1] = nr_node->routes[2];
+                       fallthrough;
                case 2:
                        break;

and then about a hundred lines later it does

                case 0:
                        s->routes[0] = s->routes[1];
                        fallthrough;
                case 1:
                        s->routes[1] = s->routes[2];
+                       break;
                case 2:
                        break;

Notice? One does a 'fallthrough' to the next case that does the 'break', and the other - very much equivalent case - does a 'break'.

So the whole "add 'fallthrough' or 'break'" decision doesn't seem to have any pattern or rule at all.

Linus

#2 lore raw
Quoted 35 lines · Linus Torvalds
Quoted 6 lines · Gustavo A. R. Silva

Please, pull the following patches that fix many fall-through warnings when building with Clang 12.0.0 and this[1] change reverted. Notice that in order to enable -Wimplicit-fallthrough for Clang, such change[1] is meant to be reverted at some point. So, these patches help to move in that direction.

I've pulled this, but I really don't like how random it is.

Just as an example - and there are many others - look at the patch to net/netrom/nr_route.c.

It does

                case 0:
                        nr_node->routes[0] = nr_node->routes[1];
                        fallthrough;
                case 1:
                        nr_node->routes[1] = nr_node->routes[2];
+                       fallthrough;
                case 2:
                        break;

and then about a hundred lines later it does

                case 0:
                        s->routes[0] = s->routes[1];
                        fallthrough;
                case 1:
                        s->routes[1] = s->routes[2];
+                       break;
                case 2:
                        break;
Quoted 5 lines

Notice? One does a 'fallthrough' to the next case that does the 'break', and the other - very much equivalent case - does a 'break'.

So the whole "add 'fallthrough' or 'break'" decision doesn't seem to have any pattern or rule at all.

I see, you're right.

I still have another PR with more of these fixes (the last ones before finally being able to enable -Wimplicit-fallthrough for Clang :) ) pending to be sent later this week. I'll double check and fix any similar issues before sending it.

Thanks for the feedback.
--
Gustavo

merge bot Merged
#3 lore raw
In reply to Gustavo A. R. Silva
The pull request you sent on Mon, 28 Jun 2021 15:59:47 -0500:

The pull request you sent on Mon, 28 Jun 2021 15:59:47 -0500:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git tags/fallthrough-fixes-clang-5.14-rc1

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/8ec035ac4a1391c16c3cf328e6e8d9531d7a229f

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html