Re: [PATCH v5] checkpatch: extend attributes check to handle more patterns
From: Dwaipayan Ray
Date: Sun Oct 25 2020 - 14:51:03 EST
> > + if (scalar @conv_array > 0 && $conv_possible == 1) {
> > + my $replace = join(' ', @conv_array);
> > + if (WARN("PREFER_DEFINED_ATTRIBUTE_MACRO",
> > + "$replace is preferred over __attribute__(($attr))\n" . $herecurr) &&
> > + $fix) {
> > + $fixed[$fixlinenr] =~ s/\b__attribute__\s*\(\s*\(\s*\Q$attr\E\s*\)\s*\)/$replace/;
>
> I looks it would be useful to add
> $fixed[$fixlinenr] =~ s/\}\Q$replace\E/} $replace/;
> so there's a space added between } and any replacements.
>
Hi once again,
Sorry to interrupt your work so many times.
I tried this and seems the space is being applied even without this
fix.
I think the spacing check applies this fix already.
if (ERROR("SPACING",
"space required after that close brace '}'\n" . $herecurr) &&
$fix) {
$fixed[$fixlinenr] =~
s/}((?!(?:,|;|\)))\S)/} $1/;
}
So do you think it's okay without that perhaps?
Thanks,
Dwaipayan.