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
501our $Hex = qr{(?i)0x[0-9a-f]+$Int_type?};501our $Hex = qr{(?i)0x[0-9a-f]+$Int_type?};
502our $Int = qr{[0-9]+$Int_type?};502our $Int = qr{[0-9]+$Int_type?};
503our $Octal = qr{0[0-7]+$Int_type?};503our $Octal = qr{0[0-7]+$Int_type?};
504our $String = qr{"[X\t]*"};504our $String = qr{(?:\b[Lu])?"[X\t]*"};
505our $Float_hex = qr{(?i)0x[0-9a-f]+p-?[0-9]+[fl]?};505our $Float_hex = qr{(?i)0x[0-9a-f]+p-?[0-9]+[fl]?};
506our $Float_dec = qr{(?i)(?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+)(?:e-?[0-9]+)?[fl]?};506our $Float_dec = qr{(?i)(?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+)(?:e-?[0-9]+)?[fl]?};
507our $Float_int = qr{(?i)[0-9]+e-?[0-9]+[fl]?};507our $Float_int = qr{(?i)[0-9]+e-?[0-9]+[fl]?};
@@ -6132,7 +6132,8 @@ sub process { · 5624 unmodified lines
6132 }6132 }
6133 6133
6134# concatenated string without spaces between elements6134# 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]$/)) {
6136 if (CHK("CONCATENATED_STRING",6137 if (CHK("CONCATENATED_STRING",
6137 "Concatenated strings should use spaces between elements\n" . $herecurr) &&6138 "Concatenated strings should use spaces between elements\n" . $herecurr) &&
6138 $fix) {6139 $fix) {
@@ -6145,7 +6146,7 @@ sub process { · 6 unmodified lines
6145 }6146 }
6146 6147
6147# uncoalesced string fragments6148# uncoalesced string fragments
6148 if ($line =~ /$String\s*"/) {6149 if ($line =~ /$String\s*[Lu]?"/) {
6149 if (WARN("STRING_FRAGMENTS",6150 if (WARN("STRING_FRAGMENTS",
6150 "Consecutive strings are generally better as a single string\n" . $herecurr) &&6151 "Consecutive strings are generally better as a single string\n" . $herecurr) &&
6151 $fix) {6152 $fix) {