qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v4 05/31] scripts: add script to fix error_append_hint/error_


From: Eric Blake
Subject: Re: [PATCH v4 05/31] scripts: add script to fix error_append_hint/error_prepend usage
Date: Tue, 1 Oct 2019 11:50:44 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0

On 10/1/19 10:52 AM, Vladimir Sementsov-Ogievskiy wrote:
error_append_hint and error_prepend will not work, if errp ==
&fatal_error, as program will exit before error_append_hint or
error_prepend call. Fix this by use of special macro
ERRP_AUTO_PROPAGATE.

Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
---


+++ b/scripts/coccinelle/fix-error-add-info.cocci
@@ -0,0 +1,28 @@
+@rule0@
+// Add invocation to errp-functions
+identifier fn;
+@@
+
+ fn(..., Error **errp, ...)
+ {

When running this script, I get lots of warnings:

init_defs_builtins: /usr/lib64/coccinelle/standard.h
warning: line 6: should errp be a metavariable?
warning: line 11: should errp be a metavariable?
warning: line 13: should errp be a metavariable?
HANDLING: include/block/nbd.h

This means we are trying to patch only an actual variable named 'errp', and not a meta-variable representing any variable of type Error ** regardless of whether it is named errp or something else. I think that's okay, in part because ERRP_AUTO_PROPAGATE() expects the exact name 'errp' to be in scope, so we cannot apply it to other variable names). But I still have to wonder if there is a way to silence the warning, or if we have any outliers (other than the intentional Error **errp_in in patch 1) using a different name for a parameter of type Error **, which should also be tweaked.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



reply via email to

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