[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080428230248.GW5401@shadowen.org>
Date: Tue, 29 Apr 2008 00:02:48 +0100
From: Andy Whitcroft <apw@...dowen.org>
To: Paul Jackson <pj@....com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: Why these dot chars in scripts/checkpatch.pl?
On Mon, Apr 28, 2008 at 03:31:22PM -0500, Paul Jackson wrote:
> Andy,
>
> Perhaps I'm loosing my magic regex pixie dust, but the dot '.' char
> in the pattern "/^.#" in the following lines looks wrong to me, as if
> one were trying to match pre-processor directives that were set in by
> one character:
This is because we always are dealing with diff lines, not real lines.
So there is always a ' ', '+', or '-' in character 0 of the line (within
a diff hunk). In some tests we may be looking at either context ' '
or new lines '+' and so its handy to use '.' over '[ \+]', and I have
maintained that model throughout the other tests.
> The command:
>
> grep '^[^#].*\/\^\.#' scripts/checkpatch.pl
>
> displays:
>
> if ($res =~ /^.#\s*include\s+\<(.*)\>/) {
> } elsif ($res =~ /^.#\s*(?:error|warning)\s+(.*)\b/) {
> if ($line =~ /(.*)\b((?:if|while|for|switch)\s*\(|do\b|else\b)/ && $line !~ /^.#/) {
> if ($line =~ /^.#\s*if\s+0\b/) {
> if ($line =~ /^.#\s*(ifdef|ifndef|elif)\s\s+/) {
> $line !~ /^.#\s*if\b.*\bNR_CPUS\b/ &&
> $line !~ /^.#\s*define\b.*\bNR_CPUS\b/ &&
>
-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