* [PATCH] ext4: address a benign compiler warning
@ 2014-02-13 2:13 ` Patrick Palka
0 siblings, 0 replies; 7+ messages in thread
From: Patrick Palka @ 2014-02-13 2:13 UTC (permalink / raw)
To: linux-kernel; +Cc: tytso, adilger.kernel, linux-ext4, Patrick Palka
When !defined(CONFIG_EXT4_DEBUG), mb_debug() should be defined as an
empty do-while statement so as to suppress the following compiler
warning:
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);
Signed-off-by: Patrick Palka <patrick@parcs.ath.cx>
---
fs/ext4/mballoc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/mballoc.h b/fs/ext4/mballoc.h
index 08481ee..92eeb98 100644
--- 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)
#endif
#define EXT4_MB_HISTORY_ALLOC 1 /* allocation */
--
1.9.0.rc3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] ext4: address a benign compiler warning
@ 2014-02-13 2:13 ` Patrick Palka
0 siblings, 0 replies; 7+ messages in thread
From: Patrick Palka @ 2014-02-13 2:13 UTC (permalink / raw)
To: linux-kernel; +Cc: tytso, adilger.kernel, linux-ext4, Patrick Palka
When !defined(CONFIG_EXT4_DEBUG), mb_debug() should be defined as an
empty do-while statement so as to suppress the following compiler
warning:
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);
Signed-off-by: Patrick Palka <patrick@parcs.ath.cx>
---
fs/ext4/mballoc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/mballoc.h b/fs/ext4/mballoc.h
index 08481ee..92eeb98 100644
--- 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)
#endif
#define EXT4_MB_HISTORY_ALLOC 1 /* allocation */
--
1.9.0.rc3
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] ext4: address a benign compiler warning
2014-02-13 2:13 ` Patrick Palka
(?)
@ 2014-02-13 2:59 ` Joe Perches
2014-02-13 4:03 ` Patrick Palka
-1 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2014-02-13 2:59 UTC (permalink / raw)
To: Patrick Palka; +Cc: linux-kernel, tytso, adilger.kernel, linux-ext4
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ext4: address a benign compiler warning
2014-02-13 2:59 ` Joe Perches
@ 2014-02-13 4:03 ` Patrick Palka
2014-02-13 4:12 ` Patrick Palka
0 siblings, 1 reply; 7+ messages in thread
From: Patrick Palka @ 2014-02-13 4:03 UTC (permalink / raw)
To: Joe Perches; +Cc: linux-kernel, Theodore Ts'o, adilger.kernel, linux-ext4
On Wed, Feb 12, 2014 at 9:59 PM, Joe Perches <joe@perches.com> wrote:
> 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
>
>
Hi Joe,
Thanks! I was not aware of that idiom. It makes a good amount of
sense. I'm going to send a revised version of the patch shortly.
Patrick
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] ext4: address a benign compiler warning
2014-02-13 4:03 ` Patrick Palka
@ 2014-02-13 4:12 ` Patrick Palka
0 siblings, 0 replies; 7+ messages in thread
From: Patrick Palka @ 2014-02-13 4:12 UTC (permalink / raw)
To: linux-kernel; +Cc: tytso, adilger.kernel, linux-ext4, joe, Patrick Palka
When !defined(CONFIG_EXT4_DEBUG), mb_debug() should be defined as a
no_printk() statement instead of an empty statement in order to suppress
the following compiler warning:
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);
Signed-off-by: Patrick Palka <patrick@parcs.ath.cx>
---
fs/ext4/mballoc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/mballoc.h b/fs/ext4/mballoc.h
index 08481ee..9347328 100644
--- 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...) no_printk(fmt, ## a)
#endif
#define EXT4_MB_HISTORY_ALLOC 1 /* allocation */
--
1.9.0.rc3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] ext4: address a benign compiler warning
@ 2014-02-13 4:12 ` Patrick Palka
0 siblings, 0 replies; 7+ messages in thread
From: Patrick Palka @ 2014-02-13 4:12 UTC (permalink / raw)
To: linux-kernel; +Cc: tytso, adilger.kernel, linux-ext4, joe, Patrick Palka
When !defined(CONFIG_EXT4_DEBUG), mb_debug() should be defined as a
no_printk() statement instead of an empty statement in order to suppress
the following compiler warning:
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);
Signed-off-by: Patrick Palka <patrick@parcs.ath.cx>
---
fs/ext4/mballoc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/mballoc.h b/fs/ext4/mballoc.h
index 08481ee..9347328 100644
--- 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...) no_printk(fmt, ## a)
#endif
#define EXT4_MB_HISTORY_ALLOC 1 /* allocation */
--
1.9.0.rc3
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] ext4: address a benign compiler warning
2014-02-13 4:12 ` Patrick Palka
(?)
@ 2014-02-18 1:43 ` Theodore Ts'o
-1 siblings, 0 replies; 7+ messages in thread
From: Theodore Ts'o @ 2014-02-18 1:43 UTC (permalink / raw)
To: Patrick Palka; +Cc: linux-kernel, adilger.kernel, linux-ext4, joe
On Wed, Feb 12, 2014 at 11:12:04PM -0500, Patrick Palka wrote:
> When !defined(CONFIG_EXT4_DEBUG), mb_debug() should be defined as a
> no_printk() statement instead of an empty statement in order to suppress
> the following compiler warning:
>
> 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);
>
> Signed-off-by: Patrick Palka <patrick@parcs.ath.cx>
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-02-18 1:44 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-13 2:13 [PATCH] ext4: address a benign compiler warning Patrick Palka
2014-02-13 2:13 ` Patrick Palka
2014-02-13 2:59 ` Joe Perches
2014-02-13 4:03 ` Patrick Palka
2014-02-13 4:12 ` Patrick Palka
2014-02-13 4:12 ` Patrick Palka
2014-02-18 1:43 ` Theodore Ts'o
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.