On Wed, Jun 05, 2024 at 12:25:21PM GMT, Ilya Maximets wrote:
> On 6/5/24 10:18, Adrian Moreno wrote:
> > Current regexp used to check whitespaces around operators does not
> > consider that there can be more than one "*" together to express pointer
> > to pointer. As a result, false positive warnings are raised [1].
> >
> > Fix the regexp to allow more than one consecutive "+" characters.
> >
> > Signed-off-by: Adrian Moreno <[email protected]>
> >
> > [1] Example of patch triggering false positives:
> >> cat <<EOF | ./utilities/checkpatch.py -s
> > diff --git a/test.c b/test.c
> > --- a/test.c
> > +++ b/test.c
> > @@ -1 +1,2 @@
> > +static void foo(struct oftable ***list, char **errorp);
> > EOF
>
> Hi, Adrian.  Please, don't include diffs like that in the commit
> message.  It is not possible to apply the patch formatted like this.
>
> If you need to add a diff - indent it and also better prefix each
> line with something, e.g. ' | diff --git a/test.c b/test.c'.
>

Yep, I see robot failed. I will just remove the diff and use the unit
test as an example :-).

> >
> > WARNING: Line lacks whitespace around operator
> > static void foo(struct oftable ***list, char **errorp);
> >
> > Lines checked: 6, Warnings: 1, Errors: 0
> > ---
> >  utilities/checkpatch.py | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py
> > index 6b293770d..891b24dcf 100755
> > --- a/utilities/checkpatch.py
> > +++ b/utilities/checkpatch.py
> > @@ -739,7 +739,7 @@ infix_operators = \
> >              '&=', '^=', '|=', '<<=', '>>=']] \
> >      + [r'[^<" ]<[^=" ]',
> >         r'[^\->" ]>[^=" ]',
> > -       r'[^ !()/"]\*[^/]',
> > +       r'[^ !()/"\*]\*[^/]',
> >         r'[^ !&()"]&',
> >         r'[^" +(]\+[^"+;]',
> >         r'[^" \-(]\-[^"\->;]',
>
> Please, add a unit test for this issue.
>

I tend to forget we have unit tests for checkpatch. Sure, I'll add one.

> Best regards, Ilya Maximets.
>

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to