qemu-arm
[Top][All Lists]
Advanced

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

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


From: Vladimir Sementsov-Ogievskiy
Subject: [PATCH v4 05/31] scripts: add script to fix error_append_hint/error_prepend usage
Date: Tue, 1 Oct 2019 18:52:53 +0300

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

CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden
CC: address@hidden

 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 @@
+@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




reply via email to

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