mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Benny Halevy <bhalevy@panasas.com>
To: Andy Whitcroft <apw@shadowen.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Joel Schopp <jschopp@austin.ibm.com>
Subject: [PATCH] checkpatch.pl: recognize the #elif preprocessor directive
Date: Tue, 01 Jan 2008 12:12:22 +0200	[thread overview]
Message-ID: <477A1206.4070805@panasas.com> (raw)

checkpatch.pl does not recognize #elif as a preprocessor directive
causing it to print bogus errors for, e.g.:
ERROR: need consistent spacing around '&' (ctx:WxV)
when the operator is not recognized as unary in this context.

for example:

void foo(void)
{
	int x, y, z;
	void *p[1] = {
#if defined(X)
		&x
#elif defined(Y)
		&y
#else
		&z
#endif
	};
}

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
---
 scripts/checkpatch.pl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 579f50f..9911c17 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -534,7 +534,7 @@ sub annotate_values {
 			$preprocessor = 1;
 			$paren_type[$paren] = 'N';
 
-		} elsif ($cur =~ /^(#\s*(?:ifdef|ifndef|if|else|endif))/o) {
+		} elsif ($cur =~ /^(#\s*(?:ifdef|ifndef|if|else|elif|endif))/o) {
 			print "PRE($1)\n" if ($debug);
 			$preprocessor = 1;
 			$type = 'N';


             reply	other threads:[~2008-01-01 10:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-01 10:12 Benny Halevy [this message]
2008-01-02  9:49 ` Andy Whitcroft

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=477A1206.4070805@panasas.com \
    --to=bhalevy@panasas.com \
    --cc=apw@shadowen.org \
    --cc=jschopp@austin.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome