Allow prefixing typical strings with L for wide strings and u for unicode strings.
Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all
Unified · Split
| @@ -501,7 +501,7 @@ our $Binary = qr{(?i)0b[01]+$Int_type?}; · 500 unmodified lines | |||
| 501 | our $Hex = qr{(?i)0x[0-9a-f]+$Int_type?}; | 501 | our $Hex = qr{(?i)0x[0-9a-f]+$Int_type?}; |
| 502 | our $Int = qr{[0-9]+$Int_type?}; | 502 | our $Int = qr{[0-9]+$Int_type?}; |
| 503 | our $Octal = qr{0[0-7]+$Int_type?}; | 503 | our $Octal = qr{0[0-7]+$Int_type?}; |
| 504 | our $String = qr{"[X\t]*"}; | 504 | our $String = qr{(?:\b[Lu])?"[X\t]*"}; |
| 505 | our $Float_hex = qr{(?i)0x[0-9a-f]+p-?[0-9]+[fl]?}; | 505 | our $Float_hex = qr{(?i)0x[0-9a-f]+p-?[0-9]+[fl]?}; |
| 506 | our $Float_dec = qr{(?i)(?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+)(?:e-?[0-9]+)?[fl]?}; | 506 | our $Float_dec = qr{(?i)(?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+)(?:e-?[0-9]+)?[fl]?}; |
| 507 | our $Float_int = qr{(?i)[0-9]+e-?[0-9]+[fl]?}; | 507 | our $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 elements | 6134 | # 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 fragments | 6148 | # 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) { |