All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch: Support wide strings
@ 2021-08-01 23:07 Simon Glass
  2021-08-01 23:59 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Glass @ 2021-08-01 23:07 UTC (permalink / raw)
  To: LKML
  Cc: Joe Perches, Simon Glass, Andy Whitcroft, Dwaipayan Ray, Lukas Bulwahn

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] checkpatch: Support wide strings
  2021-08-01 23:07 [PATCH] checkpatch: Support wide strings Simon Glass
@ 2021-08-01 23:59 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2021-08-01 23:59 UTC (permalink / raw)
  To: Simon Glass, LKML, Andrew Morton
  Cc: Andy Whitcroft, Dwaipayan Ray, Lukas Bulwahn

On Sun, 2021-08-01 at 17:07 -0600, Simon Glass wrote:
> From: Joe Perches <joe@perches.com>
> 
> Allow prefixing typical strings with L for wide strings and u for
> unicode strings.


I believe the kernel didn't need this when I wrote it.
There were no wide or unicode strings in the kernel sources.

But looking now, there _are_ wide strings in the kernel sources.

So:

Acked-by: Joe Perches <joe@perches.com>

(with some false positives, but hey it shows some...)

$ git grep -P '\b[Lu]"[A-Za-z0-9 \.]*?"'
Documentation/sphinx/cdomain.py:u"""
Documentation/sphinx/cdomain.py:        u"""Handles signatures of function-like macros.
Documentation/sphinx/kernel_abi.py:u"""
Documentation/sphinx/kernel_abi.py:    u"""KernelABI (``kernel-abi``) directive"""
Documentation/sphinx/kernel_abi.py:        u"""Run command ``cmd`` and return it's stdout as unicode."""
Documentation/sphinx/kernel_feat.py:u"""
Documentation/sphinx/kernel_feat.py:    u"""KernelFeat (``kernel-feat``) directive"""
Documentation/sphinx/kernel_feat.py:        u"""Run command ``cmd`` and return it's stdout as unicode."""
Documentation/sphinx/kernel_include.py:u"""
Documentation/sphinx/kernel_include.py:    u"""KernelInclude (``kernel-include``) directive"""
Documentation/sphinx/kfigure.py:u"""
Documentation/sphinx/kfigure.py:    u"""
Documentation/sphinx/kfigure.py:    u"""KernelImage directive
Documentation/sphinx/kfigure.py:    u"""KernelImage directive
Documentation/sphinx/kfigure.py:    u"""KernelRender directive
Documentation/sphinx/load_config.py:    u"""Load an additional configuration file into *namespace*.
Documentation/sphinx/maintainers_include.py:u"""
Documentation/sphinx/maintainers_include.py:    u"""MaintainersInclude (``maintainers-include``) directive"""
Documentation/sphinx/rstFlatTable.py:u"""
Documentation/sphinx/rstFlatTable.py:    u"""FlatTable (``flat-table``) directive"""
Documentation/sphinx/rstFlatTable.py:    u"""Builds a table from a double-stage list"""
Documentation/sphinx/rstFlatTable.py:        u"""parses the node from a :py:class:`FlatTable` directive's body"""
Documentation/sphinx/rstFlatTable.py:        u"""Round off the table definition.
arch/x86/platform/efi/quirks.c:static const efi_char16_t efi_dummy_name[] = L"DUMMY";
arch/x86/xen/efi.c:             efi_systab_xen.fw_vendor = __pa_symbol(L"UNKNOWN");
arch/x86/xen/efi.c:     status = efi.get_variable(L"MokSBStateRT", &shim_guid,
drivers/firmware/efi/libstub/secureboot.c:static const efi_char16_t shim_MokSBState_name[] = L"MokSBState";
drivers/firmware/efi/libstub/tpm.c:     L"MemoryOverwriteRequestControl";
drivers/firmware/efi/libstub/x86-stub.c:static const efi_char16_t apple[] = L"Apple";
drivers/input/keyboard/applespi.c:#define EFI_BL_LEVEL_NAME     L"KeyboardBacklightLevel"
drivers/net/wireless/intel/iwlwifi/fw/uefi.h:#define IWL_UEFI_OEM_PNVM_NAME             L"UefiCnvWlanOemSignedPnvm"
drivers/net/wireless/intel/iwlwifi/fw/uefi.h:#define IWL_UEFI_REDUCED_POWER_NAME        L"UefiCnvWlanReducedPower"
drivers/platform/mellanox/mlxbf-tmfifo.c:static efi_char16_t mlxbf_tmfifo_efi_name[] = L"RshimMacAddr";
fs/ceph/file.c:         dout("aio_write %p %llx.%llx %llu~%u" "got EOLDSNAPC, retrying\n",
include/linux/efi.h:    status = get_var(L"SecureBoot", &EFI_GLOBAL_VARIABLE_GUID, NULL, &size,
include/linux/efi.h:    get_var(L"SetupMode", &EFI_GLOBAL_VARIABLE_GUID, NULL, &size, &setupmode);
security/integrity/platform_certs/load_uefi.c:  status = efi.get_variable(L"MokIgnoreDB", &guid, NULL, &size, &db);
security/integrity/platform_certs/load_uefi.c:  mok = get_cert_list(L"MokListRT", &mok_var, &moksize, &status);
security/integrity/platform_certs/load_uefi.c:          db = get_cert_list(L"db", &secure_var, &dbsize, &status);
security/integrity/platform_certs/load_uefi.c:  dbx = get_cert_list(L"dbx", &secure_var, &dbxsize, &status);
security/integrity/platform_certs/load_uefi.c:  mokx = get_cert_list(L"MokListXRT", &mok_var, &mokxsize, &status);



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-01 23:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-01 23:07 [PATCH] checkpatch: Support wide strings Simon Glass
2021-08-01 23:59 ` Joe Perches

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.