Re: */ in string confuses checkpatch.pl



On Tue, Oct 21, 2008 at 09:57:26AM +0900, penguin-kernel@xxxxxxxxxxxxxxxxxxx wrote:
Hello.

The below code confuses checkpatch.pl ver 0.21.

Regards.
----------
# cat /tmp/foo.c
void foo(void)
{
bar(\" /proc/\\\\*/\");
bar(\" /proc/\\\\$/\");
}
# /usr/src/vanilla/linux-2.6.27.2/scripts/checkpatch.pl --file /tmp/foo.c
ERROR: need consistent spacing around \'/\' (ctx:WxV)
#4: FILE: tmp/foo.c:4:
+ bar(\" /proc/\\\\$/\");
^

total: 1 errors, 0 warnings, 5 lines checked

/tmp/foo.c has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

I am unable to reproduce this here with any version from current back to
v0.19, nor with the one I find in v2.6.27.2 (see below). Though looking at
the code as presented in your example I can see how it might be interpreted
incorrectly. That said the compiler doesn't seem to be able to understand
this either (also below). In particular you effectivly open a quote on
the third line and never close it.

Could you send me both the checkpatch script and the foo.c as attachments
so I can be sure I have them without some emailer somewhere mushing
them up.

Thanks for you report.

-apw

$ cat ../checkpatch/Z213.c
void foo(void)
{
bar(\" /proc/\\\\*/\");
bar(\" /proc/\\\\$/\");
}
$ cc -c Z213.c
Z213.c: In function ‘foo’:
Z213.c:3: error: stray ‘\’ in program
Z213.c:3:7: warning: missing terminating " character
Z213.c:3: error: missing terminating " character
Z213.c:4: error: stray ‘\’ in program
Z213.c:4:7: warning: missing terminating " character
Z213.c:4: error: missing terminating " character
Z213.c:5: error: expected expression before ‘}’ token
Z213.c:5: error: expected ‘)’ before ‘}’ token
Z213.c:5: error: expected ‘;’ before ‘}’ token

$ git checkout v2.6.27.2
HEAD is now at 6bcd6d7... Linux 2.6.27.2
apw@brain$ ./scripts/checkpatch.pl --file ../checkpatch/Z213.c
total: 0 errors, 0 warnings, 5 lines checked

../checkpatch/Z213.c has no obvious style problems and is ready for submission.
$
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • asterisk-slash sequence in quoted string confuses checkpatch.pl
    ... The below code confuses checkpatch.pl ver 0.21. ... # cat /tmp/foo.c ... void foo ... are false positives report them to the maintainer, ...
    (Linux-Kernel)
  • Re: void* arithmnetic
    ... Since begin of the ages the build of the nvidia driver says things like ... There are several of this warnings. ... I think the warning is correct and that void* arithmetic is undefined in C, ... $ cat voidptr.c ...
    (Linux-Kernel)
  • Re: Using an array to search a text file
    ... $ cat mkifile ... use warnings; ... use strict; ... $ ./mkifile | tee ifile ...
    (comp.lang.perl.misc)
  • About the remoting event
    ... callback port in the client side, but told that these was an exception on the ... static void Main ... Cat cat = new Cat; ...
    (microsoft.public.dotnet.languages.csharp)
  • [PATCH] x86_64: fix section mismatch warnings
    ... Fix the following section mismatch warnings on x86_64: ... The warnings does not show up during a normal build due to kbuild ... -static void nvidia_bugs ... extern int fallback_aper_order; ...
    (Linux-Kernel)