All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/9] fix -Wempty-body build warnings
@ 2020-04-18 18:41 ` Randy Dunlap
  0 siblings, 0 replies; 156+ messages in thread
From: Randy Dunlap @ 2020-04-18 18:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: alsa-devel, Randy Dunlap, Zzy Wysm, J. Bruce Fields, target-devel,
	Dave Jiang, linux-scsi, linux-nvdimm, Vishal Verma, Chuck Lever,
	linux-input, Alexander Viro, Dan Williams, Andrew Morton,
	linux-nfs, Martin K. Petersen, Greg Kroah-Hartman,
	Dmitry Torokhov, Takashi Iwai, linux-usb, linux-fsdevel,
	Johannes Berg, Linus Torvalds

Hi,

When -Wextra is used, gcc emits many warnings about an empty 'if' or
'else' body, like this:

../fs/posix_acl.c: In function ‘get_acl’:
../fs/posix_acl.c:127:22: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
   /* fall through */ ;
                      ^

To quieten these warnings, add a new macro "do_empty()".
I originally wanted to use do_nothing(), but that's already in use.

It would sorta be nice if "fallthrough" could be coerced for this
instead of using something like do_empty().

Or should we just use "{}" in place of ";"?
This causes some odd coding style issue IMO. E.g., see this change:

original:
 	if (cmpxchg(p, ACL_NOT_CACHED, sentinel) != ACL_NOT_CACHED)
		/* fall through */ ;

with new macro:
 	if (cmpxchg(p, ACL_NOT_CACHED, sentinel) != ACL_NOT_CACHED)
		do_empty(); /* fall through */

using {}:
 	if (cmpxchg(p, ACL_NOT_CACHED, sentinel) != ACL_NOT_CACHED)
		{} /* fall through */
or
		{ /* fall through */ }
or even
 	if (cmpxchg(p, ACL_NOT_CACHED, sentinel) != ACL_NOT_CACHED) {
		/* fall through */ }
or
 	if (cmpxchg(p, ACL_NOT_CACHED, sentinel) != ACL_NOT_CACHED) {
		} /* fall through */


 drivers/base/devcoredump.c         |    5 +++--
 drivers/dax/bus.c                  |    5 +++--
 drivers/input/mouse/synaptics.c    |    3 ++-
 drivers/target/target_core_pscsi.c |    3 ++-
 drivers/usb/core/sysfs.c           |    2 +-
 fs/nfsd/nfs4state.c                |    3 ++-
 fs/posix_acl.c                     |    2 +-
 include/linux/kernel.h             |    8 ++++++++
 sound/drivers/vx/vx_core.c         |    3 ++-
 9 files changed, 24 insertions(+), 10 deletions(-)

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

end of thread, other threads:[~2020-04-21 13:59 UTC | newest]

Thread overview: 156+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-18 18:41 [RFC PATCH 0/9] fix -Wempty-body build warnings Randy Dunlap
2020-04-18 18:41 ` Randy Dunlap
2020-04-18 18:41 ` Randy Dunlap
2020-04-18 18:41 ` Randy Dunlap
2020-04-18 18:41 ` [RFC PATCH 1/9] kernel.h: add do_empty() macro Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:44   ` Joe Perches
2020-04-18 18:44     ` Joe Perches
2020-04-18 18:44     ` Joe Perches
2020-04-18 18:44     ` Joe Perches
2020-04-18 18:49     ` Randy Dunlap
2020-04-18 18:49       ` Randy Dunlap
2020-04-18 18:49       ` Randy Dunlap
2020-04-18 18:49       ` Randy Dunlap
2020-04-18 22:20   ` Bart Van Assche
2020-04-18 22:20     ` Bart Van Assche
2020-04-18 22:20     ` Bart Van Assche
2020-04-18 22:20     ` Bart Van Assche
2020-04-18 22:24     ` Randy Dunlap
2020-04-18 22:24       ` Randy Dunlap
2020-04-18 22:24       ` Randy Dunlap
2020-04-18 22:24       ` Randy Dunlap
2020-04-18 18:41 ` [PATCH 2/9] fs: fix empty-body warning in posix_acl.c Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:53   ` Linus Torvalds
2020-04-18 18:53     ` Linus Torvalds
2020-04-18 18:53     ` Linus Torvalds
2020-04-18 18:53     ` Linus Torvalds
2020-04-18 18:55     ` Randy Dunlap
2020-04-18 18:55       ` Randy Dunlap
2020-04-18 18:55       ` Randy Dunlap
2020-04-18 18:55       ` Randy Dunlap
2020-04-20 19:58     ` [PATCH 2/9] " Zzy Wysm
2020-04-20 19:58       ` Zzy Wysm
2020-04-20 19:58       ` Zzy Wysm
2020-04-20 19:58       ` Zzy Wysm
2020-04-18 18:41 ` [PATCH 3/9] input: fix empty-body warning in synaptics.c Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:41 ` [PATCH 4/9] sound: fix empty-body warning in vx_core.c Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:41 ` [PATCH 5/9] usb: fix empty-body warning in sysfs.c Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:44   ` Matthew Wilcox
2020-04-18 18:44     ` Matthew Wilcox
2020-04-18 18:44     ` Matthew Wilcox
2020-04-18 18:44     ` Matthew Wilcox
2020-04-18 18:46     ` Randy Dunlap
2020-04-18 18:46       ` Randy Dunlap
2020-04-18 18:46       ` Randy Dunlap
2020-04-18 18:46       ` Randy Dunlap
2020-04-18 19:54     ` Alan Stern
2020-04-18 19:54       ` Alan Stern
2020-04-18 19:54       ` Alan Stern
2020-04-18 19:54       ` Alan Stern
2020-04-21  1:20       ` NeilBrown
2020-04-21  1:20         ` NeilBrown
2020-04-21  1:20         ` NeilBrown
2020-04-21  1:20         ` NeilBrown
2020-04-21 13:58         ` Alan Stern
2020-04-21 13:58           ` Alan Stern
2020-04-21 13:58           ` Alan Stern
2020-04-21 13:58           ` Alan Stern
2020-04-18 18:41 ` [PATCH 6/9] nfsd: fix empty-body warning in nfs4state.c Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:45   ` Chuck Lever
2020-04-18 18:45     ` Chuck Lever
2020-04-18 18:45     ` Chuck Lever
2020-04-18 18:45     ` Chuck Lever
2020-04-18 18:53     ` Joe Perches
2020-04-18 18:53       ` Joe Perches
2020-04-18 18:53       ` Joe Perches
2020-04-18 18:53       ` Joe Perches
2020-04-18 18:57       ` Randy Dunlap
2020-04-18 18:57         ` Randy Dunlap
2020-04-18 18:57         ` Randy Dunlap
2020-04-18 18:57         ` Randy Dunlap
2020-04-18 22:28     ` Trond Myklebust
2020-04-18 22:28       ` Trond Myklebust
2020-04-18 22:28       ` Trond Myklebust
2020-04-18 22:28       ` Trond Myklebust
2020-04-18 22:32       ` Randy Dunlap
2020-04-18 22:32         ` Randy Dunlap
2020-04-18 22:32         ` Randy Dunlap
2020-04-18 22:32         ` Randy Dunlap
2020-04-18 22:33         ` Chuck Lever
2020-04-18 22:33           ` Chuck Lever
2020-04-18 22:33           ` Chuck Lever
2020-04-18 22:33           ` Chuck Lever
2020-04-19  9:32   ` Sergei Shtylyov
2020-04-19  9:32     ` Sergei Shtylyov
2020-04-19  9:32     ` Sergei Shtylyov
2020-04-19  9:32     ` Sergei Shtylyov
2020-04-18 18:41 ` [PATCH 7/9] drivers/base: fix empty-body warnings in devcoredump.c Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:50   ` Matthew Wilcox
2020-04-18 18:50     ` Matthew Wilcox
2020-04-18 18:50     ` Matthew Wilcox
2020-04-18 18:50     ` Matthew Wilcox
2020-04-18 18:53     ` Randy Dunlap
2020-04-18 18:53       ` Randy Dunlap
2020-04-18 18:53       ` Randy Dunlap
2020-04-18 18:53       ` Randy Dunlap
2020-04-18 18:55       ` Joe Perches
2020-04-18 18:55         ` Joe Perches
2020-04-18 18:55         ` Joe Perches
2020-04-18 18:55         ` Joe Perches
2020-04-18 19:13         ` Matthew Wilcox
2020-04-18 19:13           ` Matthew Wilcox
2020-04-18 19:13           ` Matthew Wilcox
2020-04-18 19:13           ` Matthew Wilcox
2020-04-18 19:16           ` Johannes Berg
2020-04-18 19:16             ` Johannes Berg
2020-04-18 19:16             ` Johannes Berg
2020-04-18 19:16             ` Johannes Berg
2020-04-18 19:15         ` Linus Torvalds
2020-04-18 19:15           ` Linus Torvalds
2020-04-18 19:15           ` Linus Torvalds
2020-04-18 19:15           ` Linus Torvalds
2020-04-19 12:03           ` Greg Kroah-Hartman
2020-04-19 12:03             ` Greg Kroah-Hartman
2020-04-19 12:03             ` Greg Kroah-Hartman
2020-04-19 12:03             ` Greg Kroah-Hartman
2020-04-19  6:02   ` Greg Kroah-Hartman
2020-04-19  6:02     ` Greg Kroah-Hartman
2020-04-19  6:02     ` Greg Kroah-Hartman
2020-04-19  6:02     ` Greg Kroah-Hartman
2020-04-19  6:04     ` Greg Kroah-Hartman
2020-04-19  6:04       ` Greg Kroah-Hartman
2020-04-19  6:04       ` Greg Kroah-Hartman
2020-04-19  6:04       ` Greg Kroah-Hartman
2020-04-18 18:41 ` [PATCH 8/9] dax: fix empty-body warnings in bus.c Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-19  8:15   ` Christoph Hellwig
2020-04-19  8:15     ` Christoph Hellwig
2020-04-19  8:15     ` Christoph Hellwig
2020-04-19  8:15     ` Christoph Hellwig
2020-04-18 18:41 ` [PATCH 9/9] target: fix empty-body warning in target_core_pscsi.c Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap
2020-04-18 18:41   ` Randy Dunlap

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.