Skip to contentSkip to conversation

jbd2: avoid -Wempty-body warnings

PATCH Applied Arnd Bergmann 3 participants 3 messages Mar 22, 2021 – Apr 6, 2021 Journalling layer for block devices (JBD2)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 jbd2: avoid -Wempty-body warnings

From: Arnd Bergmann <[email protected]>

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.

---
 include/linux/jbd2.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/jbd2.h +1 -1
index 99d3cd051ac3..232e6285536a 100644
@@ -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);
Signature · 1 line
2.29.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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);
| ^

Quoted 4 lines

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

Sure. Feel free to add:

Honza

Quoted 20 lines
---
 include/linux/jbd2.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/jbd2.h +1 -1
index 99d3cd051ac3..232e6285536a 100644
@@ -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);
Signature · 1 line
2.29.2
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
maintainer Applied
#2 lore raw
Quoted 10 lines · Jan Kara
Quoted 9 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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);
| ^

Quoted 8 lines
Quoted 4 lines

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

Sure. Feel free to add:

Applied, thanks.

- Ted