[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0de744027ce487b20c3c585f67133b9ad1c996ab.camel@perches.com>
Date: Tue, 06 Aug 2019 03:25:37 -0700
From: Joe Perches <joe@...ches.com>
To: Brendan Jackman <brendan.jackman@...wireless.co.uk>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] checkpatch: exclude sizeof sub-expressions from
MACRO_ARG_REUSE
On Tue, 2019-08-06 at 06:59 +0000, Brendan Jackman wrote:
> The arguments of sizeof are not evaluated so arguments are safe to
> re-use in that context. Excludeing sizeof sub-expressions means
> macros like ARRAY_SIZE can pass checkpatch.
Seems sensible, thanks.
> Signed-off-by: Brendan Jackman <brendan.jackman@...wireless.co.uk>
> ---
> scripts/checkpatch.pl | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 93a7edfe0f05..907a8e8d80ae 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -5191,7 +5191,7 @@ sub process {
> next if ($arg =~ /\.\.\./);
> next if ($arg =~ /^type$/i);
> my $tmp_stmt = $define_stmt;
> - $tmp_stmt =~ s/\b(typeof|__typeof__|__builtin\w+|typecheck\s*\(\s*$Type\s*,|\#+)\s*\(*\s*$arg\s*\)*\b//g;
> + $tmp_stmt =~ s/\b(sizeof|typeof|__typeof__|__builtin\w+|typecheck\s*\(\s*$Type\s*,|\#+)\s*\(*\s*$arg\s*\)*\b//g;
> $tmp_stmt =~ s/\#+\s*$arg\b//g;
> $tmp_stmt =~ s/\b$arg\s*\#\#//g;
> my $use_cnt = () = $tmp_stmt =~ /\b$arg\b/g;
Powered by blists - more mailing lists