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 <amore...@redhat.com>
> 
> [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'.

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

Best regards, Ilya Maximets.
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to