[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Xen-devel] [RFC v2 6/9] scripts: add coccinelle script to use auto propagated errp
- To: qemu-devel@xxxxxxxxxx
- From: Vladimir Sementsov-Ogievskiy <vsementsov@xxxxxxxxxxxxx>
- Date: Mon, 23 Sep 2019 19:12:28 +0300
- Cc: stefanha@xxxxxxxxxx, codyprime@xxxxxxxxx, jan.kiszka@xxxxxxxxxxx, eblake@xxxxxxxxxx, berto@xxxxxxxxxx, zhang.zhanghailiang@xxxxxxxxxx, qemu-block@xxxxxxxxxx, arikalo@xxxxxxxxxxxx, pasic@xxxxxxxxxxxxx, hpoussin@xxxxxxxxxxx, anthony.perard@xxxxxxxxxx, samuel.thibault@xxxxxxxxxxxx, philmd@xxxxxxxxxx, green@xxxxxxxxxxxxxx, lvivier@xxxxxxxxxx, ehabkost@xxxxxxxxxx, xiechanglong.d@xxxxxxxxx, pl@xxxxxxx, dgilbert@xxxxxxxxxx, b.galvani@xxxxxxxxx, eric.auger@xxxxxxxxxx, alex.williamson@xxxxxxxxxx, ronniesahlberg@xxxxxxxxx, jsnow@xxxxxxxxxx, rth@xxxxxxxxxxx, kwolf@xxxxxxxxxx, vsementsov@xxxxxxxxxxxxx, andrew@xxxxxxxx, crwulff@xxxxxxxxx, sundeep.lkml@xxxxxxxxx, michael@xxxxxxxx, qemu-ppc@xxxxxxxxxx, kbastian@xxxxxxxxxxxxxxxxxxxxx, imammedo@xxxxxxxxxx, fam@xxxxxxxxxx, peter.maydell@xxxxxxxxxx, sheepdog@xxxxxxxxxxxxxx, david@xxxxxxxxxx, palmer@xxxxxxxxxx, thuth@xxxxxxxxxx, jcmvbkbc@xxxxxxxxx, den@xxxxxxxxxx, hare@xxxxxxxx, sstabellini@xxxxxxxxxx, arei.gonglei@xxxxxxxxxx, marcel.apfelbaum@xxxxxxxxx, namei.unix@xxxxxxxxx, atar4qemu@xxxxxxxxx, farman@xxxxxxxxxxxxx, amit@xxxxxxxxxx, sw@xxxxxxxxxxx, groug@xxxxxxxx, qemu-s390x@xxxxxxxxxx, qemu-arm@xxxxxxxxxx, peter.chubb@xxxxxxxxxxxx, clg@xxxxxxxx, shorne@xxxxxxxxx, qemu-riscv@xxxxxxxxxx, cohuck@xxxxxxxxxx, amarkovic@xxxxxxxxxxxx, aurelien@xxxxxxxxxxx, pburton@xxxxxxxxxxxx, sagark@xxxxxxxxxxxxxxxxx, jasowang@xxxxxxxxxx, kraxel@xxxxxxxxxx, edgar.iglesias@xxxxxxxxx, gxt@xxxxxxxxxxxxxxx, ari@xxxxxxxxxx, quintela@xxxxxxxxxx, mdroth@xxxxxxxxxxxxxxxxxx, lersek@xxxxxxxxxx, borntraeger@xxxxxxxxxx, antonynpavlov@xxxxxxxxx, dillaman@xxxxxxxxxx, joel@xxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, integration@xxxxxxxxxxx, balrogg@xxxxxxxxx, rjones@xxxxxxxxxx, Andrew.Baumann@xxxxxxxxxxxxx, mreitz@xxxxxxxxxx, walling@xxxxxxxxxxxxx, mst@xxxxxxxxxx, mark.cave-ayland@xxxxxxxxxxxx, v.maffione@xxxxxxxxx, marex@xxxxxxx, armbru@xxxxxxxxxx, marcandre.lureau@xxxxxxxxxx, alistair@xxxxxxxxxxxxx, paul.durrant@xxxxxxxxxx, pavel.dovgaluk@xxxxxxxxx, g.lettieri@xxxxxxxxxxxx, rizzo@xxxxxxxxxxxx, david@xxxxxxxxxxxxxxxxxxxxx, akrowiak@xxxxxxxxxxxxx, berrange@xxxxxxxxxx, xiaoguangrong.eric@xxxxxxxxx, pmorel@xxxxxxxxxxxxx, wencongyang2@xxxxxxxxxx, jcd@xxxxxxxxxxxxxxx, pbonzini@xxxxxxxxxx, stefanb@xxxxxxxxxxxxx
- Delivery-date: Mon, 23 Sep 2019 17:16:22 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@xxxxxxxxxxxxx>
---
scripts/coccinelle/auto-propagated-errp.cocci | 82 +++++++++++++++++++
1 file changed, 82 insertions(+)
create mode 100644 scripts/coccinelle/auto-propagated-errp.cocci
diff --git a/scripts/coccinelle/auto-propagated-errp.cocci
b/scripts/coccinelle/auto-propagated-errp.cocci
new file mode 100644
index 0000000000..1a3f006f0b
--- /dev/null
+++ b/scripts/coccinelle/auto-propagated-errp.cocci
@@ -0,0 +1,82 @@
+@@
+identifier fn;
+identifier local_err;
+@@
+
+ fn(..., Error **errp)
+ {
++ ERRP_FUNCTION_BEGIN();
+ }
+
+@rule1@
+identifier fn;
+identifier local_err;
+@@
+
+ fn(..., Error **errp)
+ {
+ <...
+- Error *local_err = NULL;
+ ...>
+ }
+
+@@
+identifier rule1.fn;
+identifier rule1.local_err;
+identifier out;
+@@
+
+ fn(...)
+ {
+ <...
+- goto out;
++ return;
+ ...>
+- out:
+- error_propagate(errp, local_err);
+ }
+
+@@
+identifier rule1.fn;
+identifier rule1.local_err;
+@@
+
+ fn(...)
+ {
+ <...
+(
+- error_free(local_err);
+- local_err = NULL;
++ error_free_errp(errp);
+|
+- error_free(local_err);
++ error_free_errp(errp);
+|
+- error_report_err(local_err);
++ error_report_errp(errp);
+|
+- warn_report_err(local_err);
++ warn_report_errp(errp);
+|
+- error_propagate(errp, local_err);
+)
+ ...>
+ }
+
+@@
+identifier rule1.fn;
+identifier rule1.local_err;
+@@
+
+ fn(...)
+ {
+ <...
+(
+- &local_err
++ errp
+|
+- local_err
++ *errp
+)
+ ...>
+ }
--
2.21.0
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|