Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1223394 > unrolled thread

possible new false positive in checkpatch

Started byTal Shorer <tal.shorer@gmail.com>
First post2015-09-12 14:20 +0200
Last post2015-09-15 17:10 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  possible new false positive in checkpatch Tal Shorer <tal.shorer@gmail.com> - 2015-09-12 14:20 +0200
    Re: possible new false positive in checkpatch Andy Whitcroft <apw@canonical.com> - 2015-09-14 12:30 +0200
      Re: possible new false positive in checkpatch Tal Shorer <tal.shorer@gmail.com> - 2015-09-15 17:00 +0200
        Re: possible new false positive in checkpatch Andy Whitcroft <apw@canonical.com> - 2015-09-15 17:10 +0200

#1223394 — possible new false positive in checkpatch

FromTal Shorer <tal.shorer@gmail.com>
Date2015-09-12 14:20 +0200
Subjectpossible new false positive in checkpatch
Message-ID<q7RWG-ds-5@gated-at.bofh.it>
Since my last pull from upstream (today) , I started seeing some
checkpatch warnings regarding suspect code indent I believe are false
positive. Take this code for example:

static int foo(void)
{
	while (bar())
		/* do nothing */;
}

When running checkpath on it, the following warning is emitted:

tal@tal:~/Dev/lfs/linux|0 $ scripts/checkpatch.pl -f ~/tmp/foo.c
WARNING: suspect code indent for conditional statements (8, 32)
#3: FILE: /home/tal/tmp/foo.c:3:
+	while (bar())
+		/* do nothing */;

total: 0 errors, 1 warnings, 5 lines checked

/home/tal/tmp/foo.c has style problems, please review.

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
tal@tal:~/Dev/lfs/linux|1 $ 

Using my limited perl knowledge, I believe the lines causing this are
3111-3133:
			# remove inline comments
			$s =~ s/$;/ /g;
			$c =~ s/$;/ /g;
Introduced in commit 9f5af480f4554aac12e002b6f5c2b04895857700:
checkpatch: improve SUSPECT_CODE_INDENT test
Commenting out these lines removes the warning.

This pattern exists in many places around the kernel source.
Is this the intended behavior?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1224007

FromAndy Whitcroft <apw@canonical.com>
Date2015-09-14 12:30 +0200
Message-ID<q8zbk-3r6-15@gated-at.bofh.it>
In reply to#1223394
On Sat, Sep 12, 2015 at 03:13:31PM +0300, Tal Shorer wrote:
> Since my last pull from upstream (today) , I started seeing some
> checkpatch warnings regarding suspect code indent I believe are false
> positive. Take this code for example:
> 
> static int foo(void)
> {
> 	while (bar())
> 		/* do nothing */;
> }
> 
> When running checkpath on it, the following warning is emitted:
> 
> tal@tal:~/Dev/lfs/linux|0 $ scripts/checkpatch.pl -f ~/tmp/foo.c
> WARNING: suspect code indent for conditional statements (8, 32)
> #3: FILE: /home/tal/tmp/foo.c:3:
> +	while (bar())
> +		/* do nothing */;
> 
> total: 0 errors, 1 warnings, 5 lines checked
> 
> /home/tal/tmp/foo.c has style problems, please review.
> 
> NOTE: If any of the errors are false positives, please report
>       them to the maintainer, see CHECKPATCH in MAINTAINERS.
> tal@tal:~/Dev/lfs/linux|1 $ 
> 
> Using my limited perl knowledge, I believe the lines causing this are
> 3111-3133:
> 			# remove inline comments
> 			$s =~ s/$;/ /g;
> 			$c =~ s/$;/ /g;

Yes it feels like that should be eliding them completely, and likely any
following space as well, something like this:

	$s =~ s/$;+\s*//g;
	$c =~ s/$;+\s*//g;

> Introduced in commit 9f5af480f4554aac12e002b6f5c2b04895857700:
> checkpatch: improve SUSPECT_CODE_INDENT test
> Commenting out these lines removes the warning.
> 
> This pattern exists in many places around the kernel source.
> Is this the intended behavior?

Seems wrong to me.

-apw
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1225270

FromTal Shorer <tal.shorer@gmail.com>
Date2015-09-15 17:00 +0200
Message-ID<q8ZSa-7YI-23@gated-at.bofh.it>
In reply to#1224007
On Mon, Sep 14, 2015 at 1:27 PM, Andy Whitcroft <apw@canonical.com> wrote:
>
> On Sat, Sep 12, 2015 at 03:13:31PM +0300, Tal Shorer wrote:
> > Since my last pull from upstream (today) , I started seeing some
> > checkpatch warnings regarding suspect code indent I believe are false
> > positive. Take this code for example:
> >
> > static int foo(void)
> > {
> >       while (bar())
> >               /* do nothing */;
> > }
> >
> > When running checkpath on it, the following warning is emitted:
> >
> > tal@tal:~/Dev/lfs/linux|0 $ scripts/checkpatch.pl -f ~/tmp/foo.c
> > WARNING: suspect code indent for conditional statements (8, 32)
> > #3: FILE: /home/tal/tmp/foo.c:3:
> > +     while (bar())
> > +             /* do nothing */;
> >
> > total: 0 errors, 1 warnings, 5 lines checked
> >
> > /home/tal/tmp/foo.c has style problems, please review.
> >
> > NOTE: If any of the errors are false positives, please report
> >       them to the maintainer, see CHECKPATCH in MAINTAINERS.
> > tal@tal:~/Dev/lfs/linux|1 $
> >
> > Using my limited perl knowledge, I believe the lines causing this are
> > 3111-3133:
> >                       # remove inline comments
> >                       $s =~ s/$;/ /g;
> >                       $c =~ s/$;/ /g;
>
> Yes it feels like that should be eliding them completely, and likely any
> following space as well, something like this:
>
>         $s =~ s/$;+\s*//g;
>         $c =~ s/$;+\s*//g;
>
Replacing the problematic lines with these fixes the issue.
> > Introduced in commit 9f5af480f4554aac12e002b6f5c2b04895857700:
> > checkpatch: improve SUSPECT_CODE_INDENT test
> > Commenting out these lines removes the warning.
> >
> > This pattern exists in many places around the kernel source.
> > Is this the intended behavior?
>
> Seems wrong to me.
>
> -apw

Which git tree is checkpatch developed in? Linus's?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1225278

FromAndy Whitcroft <apw@canonical.com>
Date2015-09-15 17:10 +0200
Message-ID<q901Q-8qX-33@gated-at.bofh.it>
In reply to#1225270
On Tue, Sep 15, 2015 at 05:50:40PM +0300, Tal Shorer wrote:

> > Yes it feels like that should be eliding them completely, and likely any
> > following space as well, something like this:
> >
> >         $s =~ s/$;+\s*//g;
> >         $c =~ s/$;+\s*//g;
> >
> Replacing the problematic lines with these fixes the issue.
> > > Introduced in commit 9f5af480f4554aac12e002b6f5c2b04895857700:
> > > checkpatch: improve SUSPECT_CODE_INDENT test
> > > Commenting out these lines removes the warning.
> > >
> > > This pattern exists in many places around the kernel source.
> > > Is this the intended behavior?
> >
> > Seems wrong to me.
> >
> > -apw
> 
> Which git tree is checkpatch developed in? Linus's?

Yeah in Linus' tree.

-apw
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web