md: bcache: avoid -Wempty-body warnings
authorArnd Bergmann <arnd@arndb.de>
Sun, 11 Apr 2021 13:43:13 +0000 (21:43 +0800)
committerJens Axboe <axboe@kernel.dk>
Sun, 11 Apr 2021 14:37:56 +0000 (08:37 -0600)
building with 'make W=1' shows a harmless warning for each user of the
EBUG_ON() macro:

drivers/md/bcache/bset.c: In function 'bch_btree_sort_partial':
drivers/md/bcache/util.h:30:55: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
   30 | #define EBUG_ON(cond)                   do { if (cond); } while (0)
      |                                                       ^
drivers/md/bcache/bset.c:1312:9: note: in expansion of macro 'EBUG_ON'
 1312 |         EBUG_ON(oldsize >= 0 && bch_count_data(b) != oldsize);
      |         ^~~~~~~

Reword the macro slightly to avoid the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Coly Li <colyli@suse.de>
Link: https://lore.kernel.org/r/20210411134316.80274-5-colyli@suse.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/bcache/util.h

index c029f744319080570704de408d0cbcfff2c788e5..bca4a7c97da7c0b0ba8a274b4092784721d98844 100644 (file)
@@ -27,7 +27,7 @@ struct closure;
 
 #else /* DEBUG */
 
-#define EBUG_ON(cond)                  do { if (cond); } while (0)
+#define EBUG_ON(cond)          do { if (cond) do {} while (0); } while (0)
 #define atomic_dec_bug(v)      atomic_dec(v)
 #define atomic_inc_bug(v, i)   atomic_inc(v)