All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] jbd2: avoid -Wempty-body warnings
@ 2021-03-22 10:21 Arnd Bergmann
  2021-03-30 15:15 ` Jan Kara
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2021-03-22 10:21 UTC (permalink / raw)
  To: Theodore Ts'o, Jan Kara
  Cc: Arnd Bergmann, Harshad Shirwadkar, Mauricio Faria de Oliveira,
	Andreas Dilger, Mauro Carvalho Chehab, zhangyi (F),
	Alexander Lochmann, Hui Su, linux-ext4, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

Building with 'make W=1' shows a harmless -Wempty-body warning:

fs/jbd2/recovery.c: In function 'fc_do_one_pass':
fs/jbd2/recovery.c:267:75: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
  267 |                 jbd_debug(3, "Fast commit replay failed, err = %d\n", err);
      |                                                                           ^

Change the empty dprintk() macros to no_printk(), which avoids this
warning and adds format string checking.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/jbd2.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 99d3cd051ac3..232e6285536a 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -61,7 +61,7 @@ void __jbd2_debug(int level, const char *file, const char *func,
 #define jbd_debug(n, fmt, a...) \
 	__jbd2_debug((n), __FILE__, __func__, __LINE__, (fmt), ##a)
 #else
-#define jbd_debug(n, fmt, a...)    /**/
+#define jbd_debug(n, fmt, a...)  no_printk(fmt, ##a)
 #endif
 
 extern void *jbd2_alloc(size_t size, gfp_t flags);
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] jbd2: avoid -Wempty-body warnings
  2021-03-22 10:21 [PATCH] jbd2: avoid -Wempty-body warnings Arnd Bergmann
@ 2021-03-30 15:15 ` Jan Kara
  2021-04-06  2:39   ` Theodore Ts'o
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2021-03-30 15:15 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Theodore Ts'o, Jan Kara, Arnd Bergmann, Harshad Shirwadkar,
	Mauricio Faria de Oliveira, Andreas Dilger,
	Mauro Carvalho Chehab, zhangyi (F),
	Alexander Lochmann, Hui Su, linux-ext4, linux-kernel

On Mon 22-03-21 11:21:38, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> Building with 'make W=1' shows a harmless -Wempty-body warning:
> 
> fs/jbd2/recovery.c: In function 'fc_do_one_pass':
> fs/jbd2/recovery.c:267:75: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
>   267 |                 jbd_debug(3, "Fast commit replay failed, err = %d\n", err);
>       |                                                                           ^
> 
> Change the empty dprintk() macros to no_printk(), which avoids this
> warning and adds format string checking.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Sure. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  include/linux/jbd2.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
> index 99d3cd051ac3..232e6285536a 100644
> --- a/include/linux/jbd2.h
> +++ b/include/linux/jbd2.h
> @@ -61,7 +61,7 @@ void __jbd2_debug(int level, const char *file, const char *func,
>  #define jbd_debug(n, fmt, a...) \
>  	__jbd2_debug((n), __FILE__, __func__, __LINE__, (fmt), ##a)
>  #else
> -#define jbd_debug(n, fmt, a...)    /**/
> +#define jbd_debug(n, fmt, a...)  no_printk(fmt, ##a)
>  #endif
>  
>  extern void *jbd2_alloc(size_t size, gfp_t flags);
> -- 
> 2.29.2
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] jbd2: avoid -Wempty-body warnings
  2021-03-30 15:15 ` Jan Kara
@ 2021-04-06  2:39   ` Theodore Ts'o
  0 siblings, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2021-04-06  2:39 UTC (permalink / raw)
  To: Jan Kara
  Cc: Arnd Bergmann, Jan Kara, Arnd Bergmann, Harshad Shirwadkar,
	Mauricio Faria de Oliveira, Andreas Dilger,
	Mauro Carvalho Chehab, zhangyi (F),
	Alexander Lochmann, Hui Su, linux-ext4, linux-kernel

On Tue, Mar 30, 2021 at 05:15:33PM +0200, Jan Kara wrote:
> On Mon 22-03-21 11:21:38, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> > 
> > Building with 'make W=1' shows a harmless -Wempty-body warning:
> > 
> > fs/jbd2/recovery.c: In function 'fc_do_one_pass':
> > fs/jbd2/recovery.c:267:75: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
> >   267 |                 jbd_debug(3, "Fast commit replay failed, err = %d\n", err);
> >       |                                                                           ^
> > 
> > Change the empty dprintk() macros to no_printk(), which avoids this
> > warning and adds format string checking.
> > 
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> Sure. Feel free to add:
> 
> Reviewed-by: Jan Kara <jack@suse.cz>

Applied, thanks.

					- Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-06  2:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22 10:21 [PATCH] jbd2: avoid -Wempty-body warnings Arnd Bergmann
2021-03-30 15:15 ` Jan Kara
2021-04-06  2:39   ` 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.