[Linux-kernel-mentees] [PATCH v5] checkpatch: extend attributes check to handle more patterns

Dwaipayan Ray dwaipayanray1 at gmail.com
Sun Oct 25 18:48:40 UTC 2020


> > +                     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.


More information about the Linux-kernel-mentees mailing list