lkml.org 
[lkml]   [2020]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] parport: fix if-statement empty body warnings
Date
From: Randy Dunlap <rdunlap@infradead.org>

When debugging via DPRINTK() is not enabled, make the DPRINTK()
macro be an empty do-while block.

This fixes gcc warnings when -Wextra is set:

../drivers/parport/ieee1284.c:262:18: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
../drivers/parport/ieee1284.c:285:17: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
../drivers/parport/ieee1284.c:298:17: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
../drivers/parport/ieee1284_ops.c:576:18: 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: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Cc: linux-parport@lists.infradead.org
---
drivers/parport/ieee1284.c | 2 +-
drivers/parport/ieee1284_ops.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

--- linux-next-20200225.orig/drivers/parport/ieee1284.c
+++ linux-next-20200225/drivers/parport/ieee1284.c
@@ -34,7 +34,7 @@
#ifdef DEBUG
#define DPRINTK(stuff...) printk (stuff)
#else
-#define DPRINTK(stuff...)
+#define DPRINTK(stuff...) do {} while (0)
#endif

/* Make parport_wait_peripheral wake up.
--- linux-next-20200225.orig/drivers/parport/ieee1284_ops.c
+++ linux-next-20200225/drivers/parport/ieee1284_ops.c
@@ -30,7 +30,7 @@
#ifdef DEBUG
#define DPRINTK(stuff...) printk (stuff)
#else
-#define DPRINTK(stuff...)
+#define DPRINTK(stuff...) do {} while (0)
#endif

/*** *
\
 
 \ /
  Last update: 2020-02-28 03:09    [W:0.060 / U:3.972 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site