All of lore.kernel.org
 help / color / mirror / Atom feed
* [tip: core/rcu] locktorture.c: Fix if-statement empty body warnings
@ 2020-05-11 20:59 tip-bot2 for Randy Dunlap
  0 siblings, 0 replies; only message in thread
From: tip-bot2 for Randy Dunlap @ 2020-05-11 20:59 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Randy Dunlap, Davidlohr Bueso, Josh Triplett, Paul E. McKenney,
	x86, LKML

The following commit has been merged into the core/rcu branch of tip:

Commit-ID:     be44ae62431196ac2a55198c0855028fff3ccfb4
Gitweb:        https://git.kernel.org/tip/be44ae62431196ac2a55198c0855028fff3ccfb4
Author:        Randy Dunlap <rdunlap@infradead.org>
AuthorDate:    Tue, 25 Feb 2020 21:09:19 -08:00
Committer:     Paul E. McKenney <paulmck@kernel.org>
CommitterDate: Mon, 27 Apr 2020 11:05:13 -07:00

locktorture.c: Fix if-statement empty body warnings

When using -Wextra, gcc complains about torture_preempt_schedule()
when its definition is empty (i.e., when CONFIG_PREEMPTION is not
set/enabled).  Fix these warnings by adding an empty do-while block
for that macro when CONFIG_PREEMPTION is not set.
Fixes these build warnings:

../kernel/locking/locktorture.c:119:29: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
../kernel/locking/locktorture.c:166:29: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
../kernel/locking/locktorture.c:337:29: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
../kernel/locking/locktorture.c:490:29: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
../kernel/locking/locktorture.c:528:29: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
../kernel/locking/locktorture.c:553:29: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]

I have verified that there is no object code change (with gcc 7.5.0).

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: "Paul E. McKenney" <paulmck@kernel.org>
---
 include/linux/torture.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/torture.h b/include/linux/torture.h
index 6241f59..629b66e 100644
--- a/include/linux/torture.h
+++ b/include/linux/torture.h
@@ -89,7 +89,7 @@ void _torture_stop_kthread(char *m, struct task_struct **tp);
 #ifdef CONFIG_PREEMPTION
 #define torture_preempt_schedule() preempt_schedule()
 #else
-#define torture_preempt_schedule()
+#define torture_preempt_schedule()	do { } while (0)
 #endif
 
 #endif /* __LINUX_TORTURE_H */

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-11 20:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-11 20:59 [tip: core/rcu] locktorture.c: Fix if-statement empty body warnings tip-bot2 for 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.