All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch.pl: recognize the #elif preprocessor directive
@ 2008-01-01 10:12 Benny Halevy
  2008-01-02  9:49 ` Andy Whitcroft
  0 siblings, 1 reply; 2+ messages in thread
From: Benny Halevy @ 2008-01-01 10:12 UTC (permalink / raw)
  To: Andy Whitcroft; +Cc: lkml, Joel Schopp

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';


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-01-02  9:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-01 10:12 [PATCH] checkpatch.pl: recognize the #elif preprocessor directive Benny Halevy
2008-01-02  9:49 ` Andy Whitcroft

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.