* checkpatch.pl misreporting bugs with array fillings
@ 2011-12-16 21:59 Marek Vasut
2011-12-16 22:24 ` Andy Whitcroft
2011-12-17 0:15 ` Joe Perches
0 siblings, 2 replies; 6+ messages in thread
From: Marek Vasut @ 2011-12-16 21:59 UTC (permalink / raw)
To: joe; +Cc: Andy Whitcroft, linux-kernel
Hi,
the following testcase is probably misreported by checkpatch.pl:
static const unsigned char pci_irq_swizzle[2][PCI_MAX_DEVICES] = {
{0, 0, 0, 0, 0, 0, 0, 27, 27, [9 ... PCI_MAX_DEVICES - 1] = 0 },
{0, 0, 0, 0, 0, 0, 0, 29, 29, [9 ... PCI_MAX_DEVICES - 1] = 0 },
};
The result is:
ERROR: space prohibited before open square bracket '['
#2: FILE: testcase.c:2:
+ {0, 0, 0, 0, 0, 0, 0, 27, 27, [9 ... PCI_MAX_DEVICES - 1] = 0 },
ERROR: space prohibited before open square bracket '['
#3: FILE: testcase.c:3:
+ {0, 0, 0, 0, 0, 0, 0, 29, 29, [9 ... PCI_MAX_DEVICES - 1] = 0 },
total: 2 errors, 0 warnings, 5 lines checked
NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX
MULTISTATEMENT_MACRO_USE_DO_WHILE
testcase.c has style problems, please review.
If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
Cheers!
M
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: checkpatch.pl misreporting bugs with array fillings
2011-12-16 21:59 checkpatch.pl misreporting bugs with array fillings Marek Vasut
@ 2011-12-16 22:24 ` Andy Whitcroft
2011-12-16 22:31 ` Marek Vasut
2011-12-17 0:15 ` Joe Perches
1 sibling, 1 reply; 6+ messages in thread
From: Andy Whitcroft @ 2011-12-16 22:24 UTC (permalink / raw)
To: Marek Vasut; +Cc: joe, linux-kernel, Andy Whitcroft
On Fri, Dec 16, 2011 at 9:59 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> Hi,
>
> the following testcase is probably misreported by checkpatch.pl:
>
> static const unsigned char pci_irq_swizzle[2][PCI_MAX_DEVICES] = {
> {0, 0, 0, 0, 0, 0, 0, 27, 27, [9 ... PCI_MAX_DEVICES - 1] = 0 },
> {0, 0, 0, 0, 0, 0, 0, 29, 29, [9 ... PCI_MAX_DEVICES - 1] = 0 },
> };
>
> The result is:
>
> ERROR: space prohibited before open square bracket '['
> #2: FILE: testcase.c:2:
> + {0, 0, 0, 0, 0, 0, 0, 27, 27, [9 ... PCI_MAX_DEVICES - 1] = 0 },
>
> ERROR: space prohibited before open square bracket '['
> #3: FILE: testcase.c:3:
> + {0, 0, 0, 0, 0, 0, 0, 29, 29, [9 ... PCI_MAX_DEVICES - 1] = 0 },
>
> total: 2 errors, 0 warnings, 5 lines checked
>
> NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX
> MULTISTATEMENT_MACRO_USE_DO_WHILE
>
> testcase.c has style problems, please review.
Hmmm will have a look...
-apw
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: checkpatch.pl misreporting bugs with array fillings
2011-12-16 22:24 ` Andy Whitcroft
@ 2011-12-16 22:31 ` Marek Vasut
2011-12-19 10:13 ` Andy Whitcroft
0 siblings, 1 reply; 6+ messages in thread
From: Marek Vasut @ 2011-12-16 22:31 UTC (permalink / raw)
To: Andy Whitcroft; +Cc: joe, linux-kernel, Andy Whitcroft
> On Fri, Dec 16, 2011 at 9:59 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> > Hi,
> >
> > the following testcase is probably misreported by checkpatch.pl:
> >
> > static const unsigned char pci_irq_swizzle[2][PCI_MAX_DEVICES] = {
> > {0, 0, 0, 0, 0, 0, 0, 27, 27, [9 ... PCI_MAX_DEVICES - 1] = 0 },
> > {0, 0, 0, 0, 0, 0, 0, 29, 29, [9 ... PCI_MAX_DEVICES - 1] = 0 },
> > };
> >
> > The result is:
> >
> > ERROR: space prohibited before open square bracket '['
> > #2: FILE: testcase.c:2:
> > + {0, 0, 0, 0, 0, 0, 0, 27, 27, [9 ... PCI_MAX_DEVICES - 1] = 0 },
> >
> > ERROR: space prohibited before open square bracket '['
> > #3: FILE: testcase.c:3:
> > + {0, 0, 0, 0, 0, 0, 0, 29, 29, [9 ... PCI_MAX_DEVICES - 1] = 0 },
> >
> > total: 2 errors, 0 warnings, 5 lines checked
> >
> > NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX
> > MULTISTATEMENT_MACRO_USE_DO_WHILE
> >
> > testcase.c has style problems, please review.
>
> Hmmm will have a look...
Thanks! I'd send a patch, but I'm now doing checkpatch cleanup of uboot sources
so I'm just submitting a testcase and delegating the issue.
M
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: checkpatch.pl misreporting bugs with array fillings
2011-12-16 22:31 ` Marek Vasut
@ 2011-12-19 10:13 ` Andy Whitcroft
0 siblings, 0 replies; 6+ messages in thread
From: Andy Whitcroft @ 2011-12-19 10:13 UTC (permalink / raw)
To: Marek Vasut; +Cc: joe, linux-kernel
On Fri, Dec 16, 2011 at 11:31:06PM +0100, Marek Vasut wrote:
> > On Fri, Dec 16, 2011 at 9:59 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> > > Hi,
> > >
> > > the following testcase is probably misreported by checkpatch.pl:
> > >
> > > static const unsigned char pci_irq_swizzle[2][PCI_MAX_DEVICES] = {
> > > {0, 0, 0, 0, 0, 0, 0, 27, 27, [9 ... PCI_MAX_DEVICES - 1] = 0 },
> > > {0, 0, 0, 0, 0, 0, 0, 29, 29, [9 ... PCI_MAX_DEVICES - 1] = 0 },
> > > };
> > >
> > > The result is:
> > >
> > > ERROR: space prohibited before open square bracket '['
> > > #2: FILE: testcase.c:2:
> > > + {0, 0, 0, 0, 0, 0, 0, 27, 27, [9 ... PCI_MAX_DEVICES - 1] = 0 },
> > >
> > > ERROR: space prohibited before open square bracket '['
> > > #3: FILE: testcase.c:3:
> > > + {0, 0, 0, 0, 0, 0, 0, 29, 29, [9 ... PCI_MAX_DEVICES - 1] = 0 },
> > >
> > > total: 2 errors, 0 warnings, 5 lines checked
> > >
> > > NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX
> > > MULTISTATEMENT_MACRO_USE_DO_WHILE
> > >
> > > testcase.c has style problems, please review.
> >
> > Hmmm will have a look...
>
> Thanks! I'd send a patch, but I'm now doing checkpatch cleanup of uboot sources
> so I'm just submitting a testcase and delegating the issue.
Ok, this one may well be simple to fix. Does the version of checkpatch
below work ok for you:
http://people.canonical.com/~apw/checkpatch/checkpatch-next.pl
-apw
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: checkpatch.pl misreporting bugs with array fillings
2011-12-16 21:59 checkpatch.pl misreporting bugs with array fillings Marek Vasut
2011-12-16 22:24 ` Andy Whitcroft
@ 2011-12-17 0:15 ` Joe Perches
2011-12-17 0:22 ` Marek Vasut
1 sibling, 1 reply; 6+ messages in thread
From: Joe Perches @ 2011-12-17 0:15 UTC (permalink / raw)
To: Marek Vasut; +Cc: Andy Whitcroft, linux-kernel
On Fri, 2011-12-16 at 22:59 +0100, Marek Vasut wrote:
> static const unsigned char pci_irq_swizzle[2][PCI_MAX_DEVICES] = {
> {0, 0, 0, 0, 0, 0, 0, 27, 27, [9 ... PCI_MAX_DEVICES - 1] = 0 },
> {0, 0, 0, 0, 0, 0, 0, 29, 29, [9 ... PCI_MAX_DEVICES - 1] = 0 },
> };
True.
Andy will probably figure it out.
He's the maintainer.
Still, in this case all the 0's are unnecessary.
I'd probably write that code as:
static const unsigned char pci_irq_swizzle[2][PCI_MAX_DEVICES] = {
{ [7] = 27, [8] = 27 },
{ [7] = 29, [8] = 29 },
};
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: checkpatch.pl misreporting bugs with array fillings
2011-12-17 0:15 ` Joe Perches
@ 2011-12-17 0:22 ` Marek Vasut
0 siblings, 0 replies; 6+ messages in thread
From: Marek Vasut @ 2011-12-17 0:22 UTC (permalink / raw)
To: Joe Perches; +Cc: Andy Whitcroft, linux-kernel
> On Fri, 2011-12-16 at 22:59 +0100, Marek Vasut wrote:
> > static const unsigned char pci_irq_swizzle[2][PCI_MAX_DEVICES] = {
> >
> > {0, 0, 0, 0, 0, 0, 0, 27, 27, [9 ... PCI_MAX_DEVICES - 1] = 0 },
> > {0, 0, 0, 0, 0, 0, 0, 29, 29, [9 ... PCI_MAX_DEVICES - 1] = 0 },
> >
> > };
>
> True.
>
> Andy will probably figure it out.
> He's the maintainer.
>
> Still, in this case all the 0's are unnecessary.
> I'd probably write that code as:
>
> static const unsigned char pci_irq_swizzle[2][PCI_MAX_DEVICES] = {
> { [7] = 27, [8] = 27 },
> { [7] = 29, [8] = 29 },
> };
I suspect this is some remnant of ancient code where the people writing it were
not sure if the memory under this is all-zeroes. (or the section this lands in
wasn't zeroed-out)
M
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-12-19 10:14 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-16 21:59 checkpatch.pl misreporting bugs with array fillings Marek Vasut
2011-12-16 22:24 ` Andy Whitcroft
2011-12-16 22:31 ` Marek Vasut
2011-12-19 10:13 ` Andy Whitcroft
2011-12-17 0:15 ` Joe Perches
2011-12-17 0:22 ` Marek Vasut
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox