Re: [PATCH 1/5] checkpatch: fix false errors due to macroconcatenation

From: Andy Whitcroft
Date: Wed Sep 30 2009 - 13:46:20 EST


On Mon, Sep 21, 2009 at 07:14:47PM -0700, Daniel Walker wrote:
> The macro concatenation (##) sequence can cause false errors when checking
> macro's. Checkpatch doesn't currently know about the operator.
>
> For example this line,
>
> + entry = (struct ftrace_raw_##call *)raw_data; \
>
> is correct but it produces the following error,
>
> ERROR: need consistent spacing around '*' (ctx:WxB)
> + entry = (struct ftrace_raw_##call *)raw_data;\
> ^
>
> The line above doesn't have any spacing problems, and if you remove the
> macro concatenation sequence checkpatch doesn't give any errors. This change
> resolves this by just always removing "##" in every line checked.

Ok, just removing these characters in the conversion changes the
relative length of the converted form and breaks position reporting for
other checks, for instance if I stupidly convert the ## to # so its
still invalid we then get this:

+ entry = (struct ftrace_raw_##call *)raw_data; \

It is probabally more correct to include this <ident> ## <ident> form in
the definition of an identifier. I've respun this patch to do just that
and it looks like its working as we would hope.

I will get this tested properly and add it to my next batch.

Perhaps you could test the version at the url below and see if it works
better:

http://www.kernel.org/pub/linux/kernel/people/apw/checkpatch/checkpatch.pl-testing

NOTE: you want at least version 0.29-5-* which is in the process of
mirroring out.

-apw
--
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/