From: Andy Whitcroft <apw@shadowen.org>
To: Paul Jackson <pj@sgi.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Why these dot chars in scripts/checkpatch.pl?
Date: Tue, 29 Apr 2008 00:02:48 +0100 [thread overview]
Message-ID: <20080428230248.GW5401@shadowen.org> (raw)
In-Reply-To: <20080428153122.a94d21ba.pj@sgi.com>
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
prev parent reply other threads:[~2008-04-28 23:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-28 20:31 Why these dot chars in scripts/checkpatch.pl? Paul Jackson
2008-04-28 20:47 ` Rogan Dawes
2008-04-28 20:51 ` Paul Jackson
2008-04-28 22:10 ` Jan Engelhardt
2008-04-28 23:06 ` +patch " Andy Whitcroft
2008-04-29 9:51 ` Segher Boessenkool
2008-04-28 23:02 ` Andy Whitcroft [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080428230248.GW5401@shadowen.org \
--to=apw@shadowen.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pj@sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.