Re: [PATCH 1/1] checkpatch: don't fake typedefs with #define

From: Ryan Mallon
Date: Tue May 22 2012 - 21:55:04 EST


On 18/05/12 07:16, Phil Carmody wrote:

> On 17/05/12 13:54 -0700, ext Joe Perches wrote:
>>> +# check for deliberate avoidance of the above anti-typedef rule
>>> + if ($line =~ /#\s*define\s+$Ident\s+$Type\b/) {
>>> + WARN("NEW_TYPEDEFS",
>>> + "do not fake typedefs using #define\n" . $herecurr);
>>> + }
>>> +
>>
>> I think the false positive rate is pretty high.
>> I used this and don't see too many I'd remove.
>>
>> $ git grep -E "#\s*define\s+\w+\s+(struct|unsigned|char|short|int|long|const)\b"
>>
>> Got an example you want this to find?
>
> Too many. Alas I can't share them.


That sounds like the cases you have seen are in code which is not
public. I don't think I have ever seen code in the kernel, or in
proposed patches which fakes a typedef with a #define.

Is this an issue for public code, or for a private company tree? In the
latter case, the checkpatch addition should go in your private tree,
rather than mainline. It looks like, at least for mainline Linux, you
are trying to solve a non-existent problem.

~Ryan
--
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/