From: Simon Glass <sjg@chromium.org> To: LKML <linux-kernel@vger.kernel.org> Cc: Joe Perches <joe@perches.com>, Simon Glass <sjg@chromium.org>, Andy Whitcroft <apw@canonical.com>, Dwaipayan Ray <dwaipayanray1@gmail.com>, Lukas Bulwahn <lukas.bulwahn@gmail.com> Subject: [PATCH] checkpatch: Support wide strings Date: Sun, 1 Aug 2021 17:07:35 -0600 [thread overview] Message-ID: <20210801170733.1.I3f9784fd3c1007d08ec2e70b151d137687575495@changeid> (raw) From: Joe Perches <joe@perches.com> Allow prefixing typical strings with L for wide strings and u for unicode strings. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Simon Glass <sjg@chromium.org> --- scripts/checkpatch.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 461d4221e4a4a1..a65753c05a6936 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -501,7 +501,7 @@ our $Binary = qr{(?i)0b[01]+$Int_type?}; our $Hex = qr{(?i)0x[0-9a-f]+$Int_type?}; our $Int = qr{[0-9]+$Int_type?}; our $Octal = qr{0[0-7]+$Int_type?}; -our $String = qr{"[X\t]*"}; +our $String = qr{(?:\b[Lu])?"[X\t]*"}; our $Float_hex = qr{(?i)0x[0-9a-f]+p-?[0-9]+[fl]?}; our $Float_dec = qr{(?i)(?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+)(?:e-?[0-9]+)?[fl]?}; our $Float_int = qr{(?i)[0-9]+e-?[0-9]+[fl]?}; @@ -6132,7 +6132,8 @@ sub process { } # concatenated string without spaces between elements - if ($line =~ /$String[A-Za-z0-9_]/ || $line =~ /[A-Za-z0-9_]$String/) { + if ($line =~ /$String[A-Z_]/ || + ($line =~ /([A-Za-z0-9_]+)$String/ && $1 !~ /^[Lu]$/)) { if (CHK("CONCATENATED_STRING", "Concatenated strings should use spaces between elements\n" . $herecurr) && $fix) { @@ -6145,7 +6146,7 @@ sub process { } # uncoalesced string fragments - if ($line =~ /$String\s*"/) { + if ($line =~ /$String\s*[Lu]?"/) { if (WARN("STRING_FRAGMENTS", "Consecutive strings are generally better as a single string\n" . $herecurr) && $fix) { -- 2.32.0.554.ge1b32706d8-goog
next reply other threads:[~2021-08-01 23:07 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-08-01 23:07 Simon Glass [this message] 2021-08-01 23:59 ` Joe Perches
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210801170733.1.I3f9784fd3c1007d08ec2e70b151d137687575495@changeid \ --to=sjg@chromium.org \ --cc=apw@canonical.com \ --cc=dwaipayanray1@gmail.com \ --cc=joe@perches.com \ --cc=linux-kernel@vger.kernel.org \ --cc=lukas.bulwahn@gmail.com \ --subject='Re: [PATCH] checkpatch: Support wide strings' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.