Skip to content

Commit 6b7eaf6

Browse files
JoePerchestorvalds
authored andcommitted
checkpatch: find hex constants as a single IDENT
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>
1 parent d1e2ad0 commit 6b7eaf6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

scripts/checkpatch.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ sub help {
230230
our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]};
231231
our $Lval = qr{$Ident(?:$Member)*};
232232

233-
our $Constant = qr{(?i:(?:[0-9]+|0x[0-9a-f]+)[ul]*)};
233+
our $Constant = qr{(?i:(?:0x[0-9a-f]+|[0-9]+)[ul]*)};
234234
our $Assignment = qr{(?:\*\=|/=|%=|\+=|-=|<<=|>>=|&=|\^=|\|=|=)};
235235
our $Compare = qr{<=|>=|==|!=|<|>};
236236
our $Operators = qr{

0 commit comments

Comments
 (0)