lkml.org 
[lkml]   [2012]   [May]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/1] checkpatch: don't fake typedefs with #define
From
Date
On Thu, 2012-05-17 at 15:52 +0300, Phil Carmody wrote:
> People seemed to be taking the "no typedefs" rule too literally,
> and were using #define to abide by the letter rather than the
> spirit of the law. E.g. #define FOO_t struct _FOO_t
>
> Signed-off-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
> ---
> scripts/checkpatch.pl | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index faea0ec..7dc41c5 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2299,6 +2299,12 @@ sub process {
> "do not add new typedefs\n" . $herecurr);
> }
>
> +# 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?




\
 
 \ /
  Last update: 2012-05-17 23:41    [W:2.805 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site