diff mbox series

[RFC] checkpatch: add regex to match decodetree structs in typeList

Message ID 20220530120750.1016067-1-matheus.ferst@eldorado.org.br
State New
Headers show
Series [RFC] checkpatch: add regex to match decodetree structs in typeList | expand

Commit Message

Matheus K. Ferst May 30, 2022, 12:07 p.m. UTC
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 mbox series

Patch

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},