qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: matheus . ferst
Subject: [RFC PATCH] checkpatch: add regex to match decodetree structs in typeList
Date: Mon, 30 May 2022 09:07:50 -0300

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]