jffs2: Fix if/else empty body warnings

When debug (print) macros are not enabled, change them to use the
no_printk() macro instead of <nothing>. This fixes gcc warnings when
-Wextra is used:

../fs/jffs2/nodelist.c:255:37: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
../fs/jffs2/nodelist.c:278:38: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
../fs/jffs2/nodelist.c:558:52: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
../fs/jffs2/xattr.c:1247:58: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
../fs/jffs2/xattr.c:1281:65: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]

Builds without warnings on all 3 levels of CONFIG_JFFS2_FS_DEBUG.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Richard Weinberger <richard@nod.at>
Cc: linux-mtd@lists.infradead.org
Signed-off-by: Richard Weinberger <richard@nod.at>
This commit is contained in:
Randy Dunlap 2020-04-05 14:22:56 -07:00 committed by Richard Weinberger
parent b8f1da98a2
commit 8fdaaf4cf3

View File

@ -13,6 +13,7 @@
#ifndef _JFFS2_DEBUG_H_ #ifndef _JFFS2_DEBUG_H_
#define _JFFS2_DEBUG_H_ #define _JFFS2_DEBUG_H_
#include <linux/printk.h>
#include <linux/sched.h> #include <linux/sched.h>
#ifndef CONFIG_JFFS2_FS_DEBUG #ifndef CONFIG_JFFS2_FS_DEBUG
@ -99,73 +100,73 @@ do { \
#ifdef JFFS2_DBG_READINODE_MESSAGES #ifdef JFFS2_DBG_READINODE_MESSAGES
#define dbg_readinode(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) #define dbg_readinode(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else #else
#define dbg_readinode(fmt, ...) #define dbg_readinode(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
#endif #endif
#ifdef JFFS2_DBG_READINODE2_MESSAGES #ifdef JFFS2_DBG_READINODE2_MESSAGES
#define dbg_readinode2(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) #define dbg_readinode2(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else #else
#define dbg_readinode2(fmt, ...) #define dbg_readinode2(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
#endif #endif
/* Fragtree build debugging messages */ /* Fragtree build debugging messages */
#ifdef JFFS2_DBG_FRAGTREE_MESSAGES #ifdef JFFS2_DBG_FRAGTREE_MESSAGES
#define dbg_fragtree(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) #define dbg_fragtree(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else #else
#define dbg_fragtree(fmt, ...) #define dbg_fragtree(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
#endif #endif
#ifdef JFFS2_DBG_FRAGTREE2_MESSAGES #ifdef JFFS2_DBG_FRAGTREE2_MESSAGES
#define dbg_fragtree2(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) #define dbg_fragtree2(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else #else
#define dbg_fragtree2(fmt, ...) #define dbg_fragtree2(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
#endif #endif
/* Directory entry list manilulation debugging messages */ /* Directory entry list manilulation debugging messages */
#ifdef JFFS2_DBG_DENTLIST_MESSAGES #ifdef JFFS2_DBG_DENTLIST_MESSAGES
#define dbg_dentlist(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) #define dbg_dentlist(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else #else
#define dbg_dentlist(fmt, ...) #define dbg_dentlist(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
#endif #endif
/* Print the messages about manipulating node_refs */ /* Print the messages about manipulating node_refs */
#ifdef JFFS2_DBG_NODEREF_MESSAGES #ifdef JFFS2_DBG_NODEREF_MESSAGES
#define dbg_noderef(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) #define dbg_noderef(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else #else
#define dbg_noderef(fmt, ...) #define dbg_noderef(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
#endif #endif
/* Manipulations with the list of inodes (JFFS2 inocache) */ /* Manipulations with the list of inodes (JFFS2 inocache) */
#ifdef JFFS2_DBG_INOCACHE_MESSAGES #ifdef JFFS2_DBG_INOCACHE_MESSAGES
#define dbg_inocache(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) #define dbg_inocache(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else #else
#define dbg_inocache(fmt, ...) #define dbg_inocache(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
#endif #endif
/* Summary debugging messages */ /* Summary debugging messages */
#ifdef JFFS2_DBG_SUMMARY_MESSAGES #ifdef JFFS2_DBG_SUMMARY_MESSAGES
#define dbg_summary(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) #define dbg_summary(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else #else
#define dbg_summary(fmt, ...) #define dbg_summary(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
#endif #endif
/* File system build messages */ /* File system build messages */
#ifdef JFFS2_DBG_FSBUILD_MESSAGES #ifdef JFFS2_DBG_FSBUILD_MESSAGES
#define dbg_fsbuild(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) #define dbg_fsbuild(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else #else
#define dbg_fsbuild(fmt, ...) #define dbg_fsbuild(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
#endif #endif
/* Watch the object allocations */ /* Watch the object allocations */
#ifdef JFFS2_DBG_MEMALLOC_MESSAGES #ifdef JFFS2_DBG_MEMALLOC_MESSAGES
#define dbg_memalloc(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) #define dbg_memalloc(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else #else
#define dbg_memalloc(fmt, ...) #define dbg_memalloc(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
#endif #endif
/* Watch the XATTR subsystem */ /* Watch the XATTR subsystem */
#ifdef JFFS2_DBG_XATTR_MESSAGES #ifdef JFFS2_DBG_XATTR_MESSAGES
#define dbg_xattr(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) #define dbg_xattr(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else #else
#define dbg_xattr(fmt, ...) #define dbg_xattr(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
#endif #endif
/* "Sanity" checks */ /* "Sanity" checks */