From: Joe Perches <joe@perches.com>
To: Patrick Palka <patrick@parcs.ath.cx>
Cc: linux-kernel@vger.kernel.org, tytso@mit.edu,
adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: address a benign compiler warning
Date: Wed, 12 Feb 2014 18:59:42 -0800 [thread overview]
Message-ID: <1392260382.2214.18.camel@joe-AO722> (raw)
In-Reply-To: <1392257593-3736-1-git-send-email-patrick@parcs.ath.cx>
On Wed, 2014-02-12 at 21:13 -0500, Patrick Palka wrote:
> When !defined(CONFIG_EXT4_DEBUG), mb_debug() should be defined as an
> empty do-while statement so as to suppress the following compiler
> warning:
Hello Patrick.
> fs/ext4/mballoc.c: In function ‘ext4_mb_cleanup_pa’:
> fs/ext4/mballoc.c:2659:47: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
> mb_debug(1, "mballoc: %u PAs left\n", count);
> ---
> diff --git a/fs/ext4/mballoc.h b/fs/ext4/mballoc.h
[]
> @@ -48,7 +48,7 @@ extern ushort ext4_mballoc_debug;
> } \
> } while (0)
> #else
> -#define mb_debug(n, fmt, a...)
> +#define mb_debug(n, fmt, a...) do { } while (0)
Ideally, this section should be something like below
so the !CONFIG_EXT4_DEBUG case still verifies that
the format and argument types match.
This can help avoid people adding debug statements but
not compiling with the proper CONFIG_<foo> variable set.
---
#ifdef CONFIG_EXT4_DEBUG
extern ushort ext4_mballoc_debug;
#define mb_debug(n, fmt, ...) \
do { \
if ((n) <= ext4_mballoc_debug) \
pr_debug(fmt, ##__VA_ARGS__); \
} \
} while (0)
#else
#define mb_debug(n, fmt, ...) \
no_printk(KERN_DEBUG fmt, ##__VA_ARGS__)
#endif
next prev parent reply other threads:[~2014-02-13 2:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-13 2:13 [PATCH] ext4: address a benign compiler warning Patrick Palka
2014-02-13 2:59 ` Joe Perches [this message]
2014-02-13 4:03 ` Patrick Palka
2014-02-13 4:12 ` Patrick Palka
2014-02-18 1:43 ` Theodore Ts'o
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=1392260382.2214.18.camel@joe-AO722 \
--to=joe@perches.com \
--cc=adilger.kernel@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patrick@parcs.ath.cx \
--cc=tytso@mit.edu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).