[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1402943256.3182.2.camel@joe-AO725>
Date: Mon, 16 Jun 2014 11:27:36 -0700
From: Joe Perches <joe@...ches.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Andy Whitcroft <apw@...onical.com>, linux-kernel@...r.kernel.org
Subject: Re: [patch] checkpatch: warn on missing spaces in broken up quoted
strings
On Mon, 2014-06-16 at 09:40 +0300, Dan Carpenter wrote:
> On Fri, Jun 13, 2014 at 12:52:25PM -0700, Joe Perches wrote:
> > On Fri, 2014-06-13 at 12:46 +0300, Dan Carpenter wrote:
> > > On Fri, Jun 13, 2014 at 02:30:22AM -0700, Joe Perches wrote:
> > >
> > > > > +# check for missing a space in a string concatination
> > > > > + if ($prevrawline =~ /[^\\][a-zA-Z]"$/ && $rawline =~ /^\+[\t ]+"[a-zA-Z]/) {
> > > > > + WARN('MISSING_SPACE',
> > > > > + "break quoted strings at a space character\n" . $hereprev);
> > > > > + }
> > > >
> > > > Probably want digits too so maybe \w instead of "[a-zA-Z]/
> >
> > Couple nits:
> >
> > The indentation isn't right here.
> >
> > And this check is probably better placed immediately
> > after the "SPLIT_STRING" test.
> >
> > []
> >
> > > ./drivers/scsi/pm8001/pm8001_ctl.c:297 "0x%08x 0x%08x\n",
> > > ./drivers/scsi/pm8001/pm8001_ctl.c:432 "0x%08x 0x%08x\n",
> > > ./drivers/scsi/qla2xxx/qla_nx2.c:1457 "0x%X 0x%X 0x%X 0x%X 0x%X 0x%X\n"
> > > - hex false positives
> >
> > These look more like defects to me.
> >
> > > I thought about doing that when I wrote my original patch but I was
> > > worried about more hex false positives. If there are only those 3 then
> > > it's probably not a big deal. What do you think?
> >
> > I know it works on files, but I'm not sure it works on patches.
> >
> > What happens when checking a single line replacement patch?
> >
> > Likely the \\[a-zA-Z] check should include
> > all the tests that the multiple line string exceptions use.
> >
> > (?:\\(?:[ntr]|[0-7]{1,3}|x[0-9a-fA-F]{1,2})|;\s*|\{\s*)"\s*$
>
> That kind of complicate regex hurts my head. How do I make it not
> complain about:
> "foo\n\t"
> "bar";
Did you try it?
The first test should handle any \n, \t or \r
at the end of a string.
[0-7]{1,3] is for octal
x[0-9afAF]{1,2} is for hex constants
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists