[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20100622103644.GE4032@shadowen.org>
Date: Tue, 22 Jun 2010 11:36:44 +0100
From: Andy Whitcroft <apw@...onical.com>
To: Joe Perches <joe@...ches.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] checkpatch.pl: Add check for space after struct or
union definition
On Thu, Jun 17, 2010 at 02:57:04AM -0700, Joe Perches wrote:
> Signed-off-by: Joe Perches <joe@...ches.com>
> ---
> scripts/checkpatch.pl | 10 ++++++++++
> 1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index bd88f11..59084fe 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1876,6 +1876,16 @@ sub process {
> ERROR("open brace '{' following function declarations go on the next line\n" . $herecurr);
> }
>
> +# missing space after union or struct definition
> + if ($rawline =~ /^\+\s*(union|struct)\s+$Ident[=\{]/) {
> + WARN("Missing space after struct or union definition\n" . $herecurr);
> + }
> +
> +# missing space after enum definition
> + if ($rawline =~ /^\+\s*enum\{/) {
> + WARN("Missing space after enum definition\n" . $herecurr);
> + }
> +
> # open braces for enum, union and struct go on the same line.
> if ($line =~ /^.\s*{/ &&
> $prevline =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?\s*$/) {
I suspect that these checks should not be against the raw line, as that
would make them match in comments and in strings as well. Also I
suspect that you also want to apply this match against union/struct {.
I'll have a look.
-apw
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists