Several files in the kernel can not be perfectly scripted to convert /* fallthrough */ style comments to fallthrough; because the direct scripted conversion causes gcc to emit warnings because the fallthrough; marking is outside of an #ifdef/#endif block.
e.g.: switch (foo) { #ifdef CONFIG_BAR case BAR: ... #endif /* fallthrough */ case BAZ: ... }
is converted via script to
switch (foo) { #ifdef CONFIG_BAR case BAR: ... #endif fallthrough; case BAZ: ... }
gcc emits a warning for the bare fallthrough; before case BAZ: when CONFIG_BAR is not enabled.
So moving the fallthrough; conversions inside the #ifdef/#endif block avoids this warning.
These are the only warnings emitted on a treewide scripted conversion as found by the kernel-robot so applying these patches allows a treewide conversion, either as multiple discrete patches or a single large patch to eventually be done.
Joe Perches (3): drm: drm_vm: Use fallthrough; net: [IPv4/IPv6]: Use fallthrough; virt: vbox: Use fallthrough;
drivers/gpu/drm/drm_vm.c | 4 ++-- drivers/virt/vboxguest/vboxguest_core.c | 2 +- drivers/virt/vboxguest/vboxguest_utils.c | 2 +- net/ipv4/af_inet.c | 4 ++-- net/ipv4/ah4.c | 2 +- net/ipv4/arp.c | 2 +- net/ipv4/devinet.c | 6 +++--- net/ipv4/fib_semantics.c | 4 ++-- net/ipv4/icmp.c | 2 +- net/ipv4/ip_output.c | 2 +- net/ipv4/ipmr.c | 2 +- net/ipv4/netfilter/nf_log_ipv4.c | 2 +- net/ipv4/netfilter/nf_nat_pptp.c | 4 ++-- net/ipv4/nexthop.c | 2 +- net/ipv4/tcp.c | 2 +- net/ipv4/tcp_input.c | 6 +++--- net/ipv4/tcp_ipv4.c | 4 ++-- net/ipv4/udp.c | 2 +- net/ipv6/addrconf.c | 6 ++---- net/ipv6/ah6.c | 2 +- net/ipv6/exthdrs.c | 2 +- net/ipv6/icmp.c | 2 +- net/ipv6/ip6_fib.c | 8 ++++---- net/ipv6/ip6mr.c | 2 +- net/ipv6/ndisc.c | 2 +- net/ipv6/netfilter/nf_log_ipv6.c | 2 +- net/ipv6/raw.c | 8 ++++---- net/ipv6/route.c | 2 +- net/ipv6/tcp_ipv6.c | 2 +- 29 files changed, 45 insertions(+), 47 deletions(-)
Convert /* fallthrough */ style comments to fallthrough;
Convert the various uses of fallthrough comments to fallthrough;
Done via script Link: https://lore.kernel.org/lkml/b56602fcf79f849e733e7b521bb0e17895d390fa.158223...
And by hand:
This file has a fallthrough comment outside of an #ifdef block that causes gcc to emit a warning if converted in-place.
So move the new fallthrough; inside the containing #ifdef/#endif too.
Signed-off-by: Joe Perches joe@perches.com --- drivers/gpu/drm/drm_vm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c index 64619f..fd65c59 100644 --- a/drivers/gpu/drm/drm_vm.c +++ b/drivers/gpu/drm/drm_vm.c @@ -595,8 +595,8 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma) vma->vm_ops = &drm_vm_ops; break; } + fallthrough; /* to _DRM_FRAME_BUFFER... */ #endif - /* fall through - to _DRM_FRAME_BUFFER... */ case _DRM_FRAME_BUFFER: case _DRM_REGISTERS: offset = drm_core_get_reg_ofs(dev); @@ -621,7 +621,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma) vma->vm_end - vma->vm_start, vma->vm_page_prot)) return -EAGAIN; vma->vm_page_prot = drm_dma_prot(map->type, vma); - /* fall through - to _DRM_SHM */ + fallthrough; /* to _DRM_SHM */ case _DRM_SHM: vma->vm_ops = &drm_vm_shm_ops; vma->vm_private_data = (void *)map;
On Thu, Mar 12, 2020 at 12:17:12PM -0700, Joe Perches wrote:
Convert /* fallthrough */ style comments to fallthrough;
Convert the various uses of fallthrough comments to fallthrough;
Done via script Link: https://lore.kernel.org/lkml/b56602fcf79f849e733e7b521bb0e17895d390fa.158223...
And by hand:
This file has a fallthrough comment outside of an #ifdef block that causes gcc to emit a warning if converted in-place.
So move the new fallthrough; inside the containing #ifdef/#endif too.
Signed-off-by: Joe Perches joe@perches.com
Acked-by: Daniel Vetter daniel.vetter@ffwll.ch
I'm assuming this all lands through a special pull? Or should I apply this? -Daniel
drivers/gpu/drm/drm_vm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c index 64619f..fd65c59 100644 --- a/drivers/gpu/drm/drm_vm.c +++ b/drivers/gpu/drm/drm_vm.c @@ -595,8 +595,8 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma) vma->vm_ops = &drm_vm_ops; break; }
fallthrough; /* to _DRM_FRAME_BUFFER... */
#endif
case _DRM_FRAME_BUFFER: case _DRM_REGISTERS: offset = drm_core_get_reg_ofs(dev);/* fall through - to _DRM_FRAME_BUFFER... */
@@ -621,7 +621,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma) vma->vm_end - vma->vm_start, vma->vm_page_prot)) return -EAGAIN; vma->vm_page_prot = drm_dma_prot(map->type, vma);
/* fall through - to _DRM_SHM */
case _DRM_SHM: vma->vm_ops = &drm_vm_shm_ops; vma->vm_private_data = (void *)map;fallthrough; /* to _DRM_SHM */
-- 2.24.0
On Tue, 2020-03-17 at 17:48 +0100, Daniel Vetter wrote:
On Thu, Mar 12, 2020 at 12:17:12PM -0700, Joe Perches wrote:
Convert /* fallthrough */ style comments to fallthrough;
Convert the various uses of fallthrough comments to fallthrough;
Done via script Link: https://lore.kernel.org/lkml/b56602fcf79f849e733e7b521bb0e17895d390fa.158223...
And by hand:
This file has a fallthrough comment outside of an #ifdef block that causes gcc to emit a warning if converted in-place.
So move the new fallthrough; inside the containing #ifdef/#endif too.
Signed-off-by: Joe Perches joe@perches.com
Acked-by: Daniel Vetter daniel.vetter@ffwll.ch
I'm assuming this all lands through a special pull? Or should I apply this?
Hi Daniel.
I think you should apply this.
The idea here is to allow a scripted conversion at some point and this patch is necessary to avoid new compiler warnings after running the script.
On Tue, Mar 17, 2020 at 03:13:29PM -0700, Joe Perches wrote:
On Tue, 2020-03-17 at 17:48 +0100, Daniel Vetter wrote:
On Thu, Mar 12, 2020 at 12:17:12PM -0700, Joe Perches wrote:
Convert /* fallthrough */ style comments to fallthrough;
Convert the various uses of fallthrough comments to fallthrough;
Done via script Link: https://lore.kernel.org/lkml/b56602fcf79f849e733e7b521bb0e17895d390fa.158223...
And by hand:
This file has a fallthrough comment outside of an #ifdef block that causes gcc to emit a warning if converted in-place.
So move the new fallthrough; inside the containing #ifdef/#endif too.
Signed-off-by: Joe Perches joe@perches.com
Acked-by: Daniel Vetter daniel.vetter@ffwll.ch
I'm assuming this all lands through a special pull? Or should I apply this?
Hi Daniel.
I think you should apply this.
The idea here is to allow a scripted conversion at some point and this patch is necessary to avoid new compiler warnings after running the script.
Ok, put into the queue but missed the 5.7 feature freeze for drm so 5.8 probably.
Thanks, Daniel
On Wed, 2020-03-18 at 14:49 +0100, Daniel Vetter wrote:
On Tue, Mar 17, 2020 at 03:13:29PM -0700, Joe Perches wrote:
On Tue, 2020-03-17 at 17:48 +0100, Daniel Vetter wrote:
On Thu, Mar 12, 2020 at 12:17:12PM -0700, Joe Perches wrote:
Convert /* fallthrough */ style comments to fallthrough;
Convert the various uses of fallthrough comments to fallthrough;
Done via script Link: https://lore.kernel.org/lkml/b56602fcf79f849e733e7b521bb0e17895d390fa.158223...
And by hand:
This file has a fallthrough comment outside of an #ifdef block that causes gcc to emit a warning if converted in-place.
So move the new fallthrough; inside the containing #ifdef/#endif too.
[]
I'm assuming this all lands through a special pull? Or should I apply this?
[]
I think you should apply this.
The idea here is to allow a scripted conversion at some point and this patch is necessary to avoid new compiler warnings after running the script.
Ok, put into the queue but missed the 5.7 feature freeze for drm so 5.8 probably.
Thanks, no worries. Any scripted conversion like this isn't a high priority.
dri-devel@lists.freedesktop.org