All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] checkpatch: add regex to match decodetree structs in typeList
@ 2022-05-30 12:07 matheus.ferst
  0 siblings, 0 replies; only message in thread
From: matheus.ferst @ 2022-05-30 12:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: danielhb413, richard.henderson, Matheus Ferst

From: Matheus Ferst <matheus.ferst@eldorado.org.br>

Decodetree generates code with structs named "arg_<identifier>" for
each argument set. When implementing methods that receive pointers to
these structs, like in [1], checkpatch will sometimes misinterpret them
as variables, resulting in errors like:

    ERROR: spaces required around that '*' (ctx:WxV)

Add a regex in typeList to match decodetree structs so they are always
correctly identified as types.

[1] https://lists.gnu.org/archive/html/qemu-ppc/2022-05/msg00431.html

Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
---
This patch does get rid of the false positives related to decodetree
structs under target/ppc/translate/, but I'm no Perl programmer, so
maybe I've misunderstood the root cause of this problem. Even if it's
correct, there may be other ways to fix this, like adding a regex to
typeTypedef, but I'm not sure what would be preferable, so RFC.
---
 scripts/checkpatch.pl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d900d18048..2b98094c6f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -305,6 +305,7 @@ our @typeList = (
 	qr{${Ident}_handler},
 	qr{${Ident}_handler_fn},
 	qr{target_(?:u)?long},
+	qr{arg_${Ident}},
 	qr{hwaddr},
         # external libraries
 	qr{xen\w+_handle},
-- 
2.25.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-30 12:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-30 12:07 [RFC PATCH] checkpatch: add regex to match decodetree structs in typeList matheus.ferst

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.