checkpatch: find hex constants as a single IDENT
authorJoe Perches <joe@perches.com>
Tue, 18 Dec 2012 00:02:02 +0000 (16:02 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 18 Dec 2012 01:15:19 +0000 (17:15 -0800)
Hexadecimal values are current found in 2 parts.  A hex constant like
0x123456abcdef is found as 0 and then x123456abcdef and later coalesced.

Instead, reverse the order of the 2 searches in $Constant to find 0x
first, then 0 so that the entire hex constant is found all at once.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/checkpatch.pl

index 725c59611e979a745dcf50068cacd80adc38be22..8cb9bfc7c14ff318416528c89158aa238bf3c3b8 100755 (executable)
@@ -230,7 +230,7 @@ our $Inline = qr{inline|__always_inline|noinline};
 our $Member    = qr{->$Ident|\.$Ident|\[[^]]*\]};
 our $Lval      = qr{$Ident(?:$Member)*};
 
-our $Constant  = qr{(?i:(?:[0-9]+|0x[0-9a-f]+)[ul]*)};
+our $Constant  = qr{(?i:(?:0x[0-9a-f]+|[0-9]+)[ul]*)};
 our $Assignment        = qr{(?:\*\=|/=|%=|\+=|-=|<<=|>>=|&=|\^=|\|=|=)};
 our $Compare    = qr{<=|>=|==|!=|<|>};
 our $Operators = qr{