Re: [PATCH] zonefs: Macros with complex values should be enclosed in parentheses

From: Damien Le Moal
Date: Mon May 10 2021 - 05:55:30 EST


On 2021/05/10 18:18, wjc wrote:
> Macros with complex values should be enclosed in parentheses
>
> Signed-off-by: wjc <wjc@xxxxxxxxxx>

Please use your full name for your Signed-off-by tag.

> ---
> fs/zonefs/trace.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/zonefs/trace.h b/fs/zonefs/trace.h
> index f369d7d50303..5b0c87d331a1 100644
> --- a/fs/zonefs/trace.h
> +++ b/fs/zonefs/trace.h
> @@ -17,7 +17,7 @@
>
> #include "zonefs.h"
>
> -#define show_dev(dev) MAJOR(dev), MINOR(dev)
> +#define show_dev(dev) (MAJOR(dev), MINOR(dev))

This macro is used in TP_printk() to specify 2 print arguments. Changing it like
you did does not even compile. Seriously, at least please compile test.

If this is from a static code analyzer, then suppressing the warning needs to be
done by removing this macro entirely.

>
> TRACE_EVENT(zonefs_zone_mgmt,
> TP_PROTO(struct inode *inode, enum req_opf op),
>


--
Damien Le Moal
Western Digital Research