[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8710630d8c01bf6f3749e3d11d193a805f2d2048.camel@perches.com>
Date: Fri, 23 Oct 2020 13:42:14 -0700
From: Joe Perches <joe@...ches.com>
To: Dwaipayan Ray <dwaipayanray1@...il.com>
Cc: linux-kernel-mentees@...ts.linuxfoundation.org,
linux-kernel <linux-kernel@...r.kernel.org>,
Lukas Bulwahn <lukas.bulwahn@...il.com>
Subject: Re: [PATCH RFC v2] checkpatch: extend attributes check to handle
more patterns
On Sat, 2020-10-24 at 00:44 +0530, Dwaipayan Ray wrote:
> Hi,
Hi again.
> I modified the check to check the attributes from the map.
> There are two checks - one for the normal attributes and
> one for the ones with arguments, which needs just a bit more
> processing.
>
> So attributes like __packed__ as well as those like
> __aligned__(x) are handled.
>
> What do you think?
>
> ---
> + $line =~ /__attribute__\s*\(\s*($balanced_parens)\s*\)/)
> {
> + my $attr = trim($1);
> + $attr =~ s/\(\s*_*(.*)\)/$1/;
> + while($attr =~ s/(.*)_$/$1/) {} # Remove trailing
> underscores
I think this could be a single test like:
while ($attr =~ /\s*(\w+)\s*(${balanced_parens})?/g) {
my $curr_attr = $1;
my $parens = $2;
$curr_attr = s/^_*(.*)_*$/$1/;
> + my %attr_list = (
> + "alias" => "__alias",
> + "aligned" => "__aligned",
These might be better using tab alignment.
And you might special case format(printf/scanf here too
Powered by blists - more mailing lists