[GEDI] [PATCH v3 05/25] scripts: add coccinelle script to fix error_append_hint usage

Vladimir Sementsov-Ogievskiy vsementsov at virtuozzo.com
Tue Sep 24 20:08:42 UTC 2019


error_append_hint will not work, if errp == &fatal_error, as program
will exit before error_append_hint call. Fix this by use of special
macro ERRP_FUNCTION_BEGIN.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov at virtuozzo.com>
---

CC: John Snow <jsnow at redhat.com>
CC: Kevin Wolf <kwolf at redhat.com>
CC: Max Reitz <mreitz at redhat.com>
CC: Fam Zheng <fam at euphon.net>
CC: Jeff Cody <codyprime at gmail.com>
CC: "Marc-André Lureau" <marcandre.lureau at redhat.com>
CC: Paolo Bonzini <pbonzini at redhat.com>
CC: Greg Kurz <groug at kaod.org>
CC: Subbaraya Sundeep <sundeep.lkml at gmail.com>
CC: Peter Maydell <peter.maydell at linaro.org>
CC: Paul Burton <pburton at wavecomp.com>
CC: Aleksandar Rikalo <arikalo at wavecomp.com>
CC: "Michael S. Tsirkin" <mst at redhat.com>
CC: Marcel Apfelbaum <marcel.apfelbaum at gmail.com>
CC: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
CC: David Gibson <david at gibson.dropbear.id.au>
CC: Yuval Shaia <yuval.shaia at oracle.com>
CC: Cornelia Huck <cohuck at redhat.com>
CC: Eric Farman <farman at linux.ibm.com>
CC: Richard Henderson <rth at twiddle.net>
CC: David Hildenbrand <david at redhat.com>
CC: Halil Pasic <pasic at linux.ibm.com>
CC: Christian Borntraeger <borntraeger at de.ibm.com>
CC: Gerd Hoffmann <kraxel at redhat.com>
CC: Alex Williamson <alex.williamson at redhat.com>
CC: Markus Armbruster <armbru at redhat.com>
CC: Michael Roth <mdroth at linux.vnet.ibm.com>
CC: Juan Quintela <quintela at redhat.com>
CC: "Dr. David Alan Gilbert" <dgilbert at redhat.com>
CC: Eric Blake <eblake at redhat.com>
CC: Jason Wang <jasowang at redhat.com>
CC: "Daniel P. Berrangé" <berrange at redhat.com>
CC: Eduardo Habkost <ehabkost at redhat.com>
CC: qemu-block at nongnu.org
CC: qemu-devel at nongnu.org
CC: integration at gluster.org
CC: qemu-arm at nongnu.org
CC: qemu-ppc at nongnu.org
CC: qemu-s390x at nongnu.org

 .../fix-error_append_hint-usage.cocci         | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 scripts/coccinelle/fix-error_append_hint-usage.cocci

diff --git a/scripts/coccinelle/fix-error_append_hint-usage.cocci b/scripts/coccinelle/fix-error_append_hint-usage.cocci
new file mode 100644
index 0000000000..327fe6098c
--- /dev/null
+++ b/scripts/coccinelle/fix-error_append_hint-usage.cocci
@@ -0,0 +1,25 @@
+ at rule0@
+// Add invocation to errp-functions
+identifier fn;
+@@
+
+ fn(..., Error **errp, ...)
+ {
++   ERRP_FUNCTION_BEGIN();
+    <+...
+    error_append_hint(errp, ...);
+    ...+>
+ }
+
+@@
+// Drop doubled invocation
+identifier rule0.fn;
+@@
+
+ fn(...)
+{
+    ERRP_FUNCTION_BEGIN();
+-   ERRP_FUNCTION_BEGIN();
+    ...
+}
+
-- 
2.21.0



More information about the integration mailing list