[GEDI] [PATCH v4 05/31] scripts: add script to fix error_append_hint/error_prepend usage

Vladimir Sementsov-Ogievskiy vsementsov at virtuozzo.com
Tue Oct 1 15:52:53 UTC 2019


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 <vsementsov at virtuozzo.com>
---

CC: kwolf at redhat.com
CC: mreitz at redhat.com
CC: jsnow at redhat.com
CC: fam at euphon.net
CC: sw at weilnetz.de
CC: codyprime at gmail.com
CC: marcandre.lureau at redhat.com
CC: pbonzini at redhat.com
CC: groug at kaod.org
CC: sundeep.lkml at gmail.com
CC: peter.maydell at linaro.org
CC: stefanha at redhat.com
CC: pburton at wavecomp.com
CC: arikalo at wavecomp.com
CC: berrange at redhat.com
CC: ehabkost at redhat.com
CC: david at gibson.dropbear.id.au
CC: clg at kaod.org
CC: mst at redhat.com
CC: marcel.apfelbaum at gmail.com
CC: mark.cave-ayland at ilande.co.uk
CC: yuval.shaia at oracle.com
CC: cohuck at redhat.com
CC: farman at linux.ibm.com
CC: rth at twiddle.net
CC: david at redhat.com
CC: pasic at linux.ibm.com
CC: borntraeger at de.ibm.com
CC: kraxel at redhat.com
CC: alex.williamson at redhat.com
CC: andrew at aj.id.au
CC: joel at jms.id.au
CC: eblake at redhat.com
CC: armbru at redhat.com
CC: mdroth at linux.vnet.ibm.com
CC: quintela at redhat.com
CC: dgilbert at redhat.com
CC: jasowang at redhat.com
CC: qemu-block 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

 scripts/coccinelle/fix-error-add-info.cocci | 28 +++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 scripts/coccinelle/fix-error-add-info.cocci

diff --git a/scripts/coccinelle/fix-error-add-info.cocci b/scripts/coccinelle/fix-error-add-info.cocci
new file mode 100644
index 0000000000..34fa3be720
--- /dev/null
+++ b/scripts/coccinelle/fix-error-add-info.cocci
@@ -0,0 +1,28 @@
+ at rule0@
+// Add invocation to errp-functions
+identifier fn;
+@@
+
+ fn(..., Error **errp, ...)
+ {
++   ERRP_AUTO_PROPAGATE();
+    <+...
+(
+    error_append_hint(errp, ...);
+|
+    error_prepend(errp, ...);
+)
+    ...+>
+ }
+
+@@
+// Drop doubled invocation
+identifier rule0.fn;
+@@
+
+ fn(...)
+{
+    ERRP_AUTO_PROPAGATE();
+-   ERRP_AUTO_PROPAGATE();
+    ...
+}
-- 
2.21.0



More information about the integration mailing list