diff mbox series

[4/9] btrfs-progs: Fix Wempty-body warning

Message ID 20181116075426.4142-5-wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: Make W=1 clean (no "again") | expand

Commit Message

Qu Wenruo Nov. 16, 2018, 7:54 a.m. UTC
messages.h:49:24: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
    PRINT_TRACE_ON_ERROR;    \

Just extra braces would solve the problem.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 messages.h | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

Comments

Nikolay Borisov Nov. 16, 2018, 8:01 a.m. UTC | #1
On 16.11.18 г. 9:54 ч., Qu Wenruo wrote:
> messages.h:49:24: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
>     PRINT_TRACE_ON_ERROR;    \
> 
> Just extra braces would solve the problem.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> ---
>  messages.h | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/messages.h b/messages.h
> index ec7d93381a36..16f650d19a4b 100644
> --- a/messages.h
> +++ b/messages.h
> @@ -45,13 +45,16 @@
>  
>  #define error_on(cond, fmt, ...)					\
>  	do {								\
> -		if ((cond))						\
> +		if ((cond)) {						\
>  			PRINT_TRACE_ON_ERROR;				\
> -		if ((cond))						\
> +		}							\
> +		if ((cond)) {						\
>  			PRINT_VERBOSE_ERROR;				\
> +		}							\
>  		__btrfs_error_on((cond), (fmt), ##__VA_ARGS__);		\
> -		if ((cond))						\
> +		if ((cond)) {						\
>  			DO_ABORT_ON_ERROR;				\
> +		}							\
>  	} while (0)
>  
>  #define error_btrfs_util(err)						\
> @@ -76,10 +79,12 @@
>  
>  #define warning_on(cond, fmt, ...)					\
>  	do {								\
> -		if ((cond))						\
> +		if ((cond)) {						\
>  			PRINT_TRACE_ON_ERROR;				\
> -		if ((cond))						\
> +		}							\
> +		if ((cond)) {						\
>  			PRINT_VERBOSE_ERROR;				\
> +		}							\
>  		__btrfs_warning_on((cond), (fmt), ##__VA_ARGS__);	\
>  	} while (0)
>  
>
diff mbox series

Patch

diff --git a/messages.h b/messages.h
index ec7d93381a36..16f650d19a4b 100644
--- a/messages.h
+++ b/messages.h
@@ -45,13 +45,16 @@ 
 
 #define error_on(cond, fmt, ...)					\
 	do {								\
-		if ((cond))						\
+		if ((cond)) {						\
 			PRINT_TRACE_ON_ERROR;				\
-		if ((cond))						\
+		}							\
+		if ((cond)) {						\
 			PRINT_VERBOSE_ERROR;				\
+		}							\
 		__btrfs_error_on((cond), (fmt), ##__VA_ARGS__);		\
-		if ((cond))						\
+		if ((cond)) {						\
 			DO_ABORT_ON_ERROR;				\
+		}							\
 	} while (0)
 
 #define error_btrfs_util(err)						\
@@ -76,10 +79,12 @@ 
 
 #define warning_on(cond, fmt, ...)					\
 	do {								\
-		if ((cond))						\
+		if ((cond)) {						\
 			PRINT_TRACE_ON_ERROR;				\
-		if ((cond))						\
+		}							\
+		if ((cond)) {						\
 			PRINT_VERBOSE_ERROR;				\
+		}							\
 		__btrfs_warning_on((cond), (fmt), ##__VA_ARGS__);	\
 	} while (0)