All of lore.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: LKML <linux-kernel@vger.kernel.org>, linux-parport@lists.infradead.org
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
	Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Subject: [PATCH] parport: fix if-statement empty body warnings
Date: Thu, 27 Feb 2020 18:08:15 -0800	[thread overview]
Message-ID: <e7868a5c-5356-bbbb-f416-799a7f75f7ad@infradead.org> (raw)

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
 
 /***                                *


             reply	other threads:[~2020-02-28  2:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-28  2:08 Randy Dunlap [this message]
2020-02-28  2:32 ` [PATCH] parport: fix if-statement empty body warnings Joe Perches
2020-02-28  2:52   ` Randy Dunlap
2020-02-28  3:19     ` Joe Perches
2020-02-28  4:19       ` Randy Dunlap
2020-02-28  8:32         ` [PATCH 0/7] parport: Use generic kernel logging styles Joe Perches
2020-02-28  8:32           ` [PATCH 1/7] parport: Convert printk(KERN_<LEVEL> to pr_<level>( Joe Perches
2020-02-28  8:32           ` [PATCH 2/7] parport: Use more comon logging styles Joe Perches
2020-03-02 19:29             ` Helge Deller
2020-03-02 19:39               ` Joe Perches
2020-03-02 20:35                 ` Helge Deller
2020-02-28  8:32           ` [PATCH 3/7] parport: daisy: Convert DPRINTK to pr_debug Joe Perches
2020-02-28  8:32           ` [PATCH 4/7] parport_amiga: " Joe Perches
2020-02-28  8:32           ` [PATCH 5/7] parport_mfc3: " Joe Perches
2020-02-28  8:32           ` [PATCH 6/7] parport_pc: " Joe Perches
2020-02-28  8:32           ` [PATCH 7/7] parport: Standardize use of printmode Joe Perches
2020-02-29 16:40           ` [PATCH 0/7] parport: Use generic kernel logging styles Randy Dunlap
2020-02-29 19:33             ` Joe Perches
2020-03-06 13:49               ` Sudip Mukherjee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e7868a5c-5356-bbbb-f416-799a7f75f7ad@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parport@lists.infradead.org \
    --cc=sudip.mukherjee@codethink.co.uk \
    --cc=sudipm.mukherjee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.