History

checkpatch: support wide strings

Allow prefixing typical strings with L for wide strings and u for unicode strings.

Joe Perches committed 5 years ago

Commit d2af5aa1 parent 7fc5b571 file · +4 −3Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+4−3
@@ -501,7 +501,7 @@ our $Binary = qr{(?i)0b[01]+$Int_type?}; · 500 unmodified lines
501501 our $Hex = qr{(?i)0x[0-9a-f]+$Int_type?};
502502 our $Int = qr{[0-9]+$Int_type?};
503503 our $Octal = qr{0[0-7]+$Int_type?};
504−our $String = qr{"[X\t]*"};
504+our $String = qr{(?:\b[Lu])?"[X\t]*"};
505505 our $Float_hex = qr{(?i)0x[0-9a-f]+p-?[0-9]+[fl]?};
506506 our $Float_dec = qr{(?i)(?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+)(?:e-?[0-9]+)?[fl]?};
507507 our $Float_int = qr{(?i)[0-9]+e-?[0-9]+[fl]?};
@@ -6132,7 +6132,8 @@ sub process { · 5624 unmodified lines
61326132 }
61336133
61346134 # concatenated string without spaces between elements
6135− if ($line =~ /$String[A-Za-z0-9_]/ || $line =~ /[A-Za-z0-9_]$String/) {
6135+ if ($line =~ /$String[A-Z_]/ ||
6136+ ($line =~ /([A-Za-z0-9_]+)$String/ && $1 !~ /^[Lu]$/)) {
61366137 if (CHK("CONCATENATED_STRING",
61376138 "Concatenated strings should use spaces between elements\n" . $herecurr) &&
61386139 $fix) {
@@ -6145,7 +6146,7 @@ sub process { · 6 unmodified lines
61456146 }
61466147
61476148 # uncoalesced string fragments
6148− if ($line =~ /$String\s*"/) {
6149+ if ($line =~ /$String\s*[Lu]?"/) {
61496150 if (WARN("STRING_FRAGMENTS",
61506151 "Consecutive strings are generally better as a single string\n" . $herecurr) &&
61516152 $fix) {