* checkpatch regression: error on #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@ 2012-01-11 21:12 Joe Perches
2012-01-20 11:53 ` Andy Whitcroft
0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2012-01-11 21:12 UTC (permalink / raw)
To: Andy Whitcroft; +Cc: Andrew Morton, linux-kernel
Current checkpatch gives:
ERROR: Macros with complex values should be enclosed in parenthesis
#18: FILE: net/ethernet/broadcom/bnx2x/bnx2x_cmn.c:18:
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
due to:
commit b3dfb9bc52e9a751e47bbc92d3a3f07e9a0029c5
Author: Andy Whitcroft <apw@canonical.com>
Date: Thu Dec 22 16:04:25 2011 +1100
checkpatch: correctly track the end of preprocessor commands in context
When looking for a statement we currently run on through preprocessor
commands. This means that a header file with just definitions is parsed
over and over again combining all of the lines from the current line to
the end of file leading to severe performance issues.
Fix up context accumulation to track preprocessor commands and stop when
reaching the end of them. At the same time vastly simplify the #define
handling.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: checkpatch regression: error on #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
2012-01-11 21:12 checkpatch regression: error on #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt Joe Perches
@ 2012-01-20 11:53 ` Andy Whitcroft
2012-01-20 13:00 ` Joe Perches
0 siblings, 1 reply; 3+ messages in thread
From: Andy Whitcroft @ 2012-01-20 11:53 UTC (permalink / raw)
To: Joe Perches; +Cc: Andrew Morton, linux-kernel
On Wed, Jan 11, 2012 at 9:12 PM, Joe Perches <joe@perches.com> wrote:
> Current checkpatch gives:
>
> ERROR: Macros with complex values should be enclosed in parenthesis
> #18: FILE: net/ethernet/broadcom/bnx2x/bnx2x_cmn.c:18:
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>
> due to:
>
> commit b3dfb9bc52e9a751e47bbc92d3a3f07e9a0029c5
> Author: Andy Whitcroft <apw@canonical.com>
> Date: Thu Dec 22 16:04:25 2011 +1100
>
> checkpatch: correctly track the end of preprocessor commands in context
That one is hard to detect as being a 'string' and therefore ok.
Ok, looks like we can detect the string concatenation occuring here
and handle this better. Does the below version work better for you:
http://people.canonical.com/~apw/checkpatch/checkpatch-next.pl
-apw
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: checkpatch regression: error on #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
2012-01-20 11:53 ` Andy Whitcroft
@ 2012-01-20 13:00 ` Joe Perches
0 siblings, 0 replies; 3+ messages in thread
From: Joe Perches @ 2012-01-20 13:00 UTC (permalink / raw)
To: Andy Whitcroft; +Cc: Andrew Morton, linux-kernel
On Fri, 2012-01-20 at 11:53 +0000, Andy Whitcroft wrote:
> On Wed, Jan 11, 2012 at 9:12 PM, Joe Perches <joe@perches.com> wrote:
> > Current checkpatch gives:
> > ERROR: Macros with complex values should be enclosed in parenthesis
> > #18: FILE: net/ethernet/broadcom/bnx2x/bnx2x_cmn.c:18:
> > +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
[]
> Does the below version work better for you:
> http://people.canonical.com/~apw/checkpatch/checkpatch-next.pl
Diff is basically:
+ # Flatten any obvious string concatentation.
+ while ($dstat =~ s/("X*")\s*$Ident/$1/ ||
+ $dstat =~ s/$Ident\s*("X*")/$1/)
+ {
+ }
Yes, that works and is appropriate.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-01-20 13:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-11 21:12 checkpatch regression: error on #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt Joe Perches
2012-01-20 11:53 ` Andy Whitcroft
2012-01-20 13:00 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox