Re: checkpatch.pl false positive
From: Joe Perches
Date: Mon May 22 2017 - 14:52:12 EST
On Fri, 2017-05-19 at 09:57 +0000, Antonio Niño Díaz wrote:
> Hello,
Hi.
> I think I've hit a corner case in checkpatch.pl. It is easy to reproduce, just create a patch with a new line such as:
>
> #define MY_HEADER <header.h>
[ checkpatch outputs ]
> config.h:9: ERROR: spaces required around that '<' (ctx:WxV)
> +#define MY_HEADER <header.h> ^
> config.h:9: ERROR: spaces required around that '>' (ctx:VxE)
> +#define MY_HEADER <header.h>
Yeah, checkpatch doesn't know about the #define before the other
things
it tests.
> Will you add this as an exception, or it is not an issue for
> you as the Linux kernel doesn't really use this weird system?
Probably not as it's not a kernel usage and
I can't think of a decent way to avoid it.
maybe some substitution like
$rawline =~ s/^(\s*#\s*define\s+\w+\s+)<([^>]+>)/\1"\2"/
could help, but it's pretty obscure and probably not
used in many other projects.
Maybe you could add and keep it local to your use.