[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC v5 025/126] scripts: add coccinelle script to use auto propagated errp
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@xxxxxxxxxxxxx> --- CC: Gerd Hoffmann <kraxel@xxxxxxxxxx> CC: "Gonglei (Arei)" <arei.gonglei@xxxxxxxxxx> CC: Eduardo Habkost <ehabkost@xxxxxxxxxx> CC: Igor Mammedov <imammedo@xxxxxxxxxx> CC: Laurent Vivier <lvivier@xxxxxxxxxx> CC: Amit Shah <amit@xxxxxxxxxx> CC: Kevin Wolf <kwolf@xxxxxxxxxx> CC: Max Reitz <mreitz@xxxxxxxxxx> CC: John Snow <jsnow@xxxxxxxxxx> CC: Ari Sundholm <ari@xxxxxxxxxx> CC: Pavel Dovgalyuk <pavel.dovgaluk@xxxxxxxxx> CC: Paolo Bonzini <pbonzini@xxxxxxxxxx> CC: Stefan Hajnoczi <stefanha@xxxxxxxxxx> CC: Fam Zheng <fam@xxxxxxxxxx> CC: Stefan Weil <sw@xxxxxxxxxxx> CC: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx> CC: Peter Lieven <pl@xxxxxxx> CC: Eric Blake <eblake@xxxxxxxxxx> CC: "Denis V. Lunev" <den@xxxxxxxxxx> CC: Markus Armbruster <armbru@xxxxxxxxxx> CC: Alberto Garcia <berto@xxxxxxxxxx> CC: Jason Dillaman <dillaman@xxxxxxxxxx> CC: Wen Congyang <wencongyang2@xxxxxxxxxx> CC: Xie Changlong <xiechanglong.d@xxxxxxxxx> CC: Liu Yuan <namei.unix@xxxxxxxxx> CC: "Richard W.M. Jones" <rjones@xxxxxxxxxx> CC: Jeff Cody <codyprime@xxxxxxxxx> CC: "Marc-André Lureau" <marcandre.lureau@xxxxxxxxxx> CC: "Daniel P. Berrangé" <berrange@xxxxxxxxxx> CC: Richard Henderson <rth@xxxxxxxxxxx> CC: Greg Kurz <groug@xxxxxxxx> CC: "Michael S. Tsirkin" <mst@xxxxxxxxxx> CC: Marcel Apfelbaum <marcel.apfelbaum@xxxxxxxxx> CC: Beniamino Galvani <b.galvani@xxxxxxxxx> CC: Peter Maydell <peter.maydell@xxxxxxxxxx> CC: "Cédric Le Goater" <clg@xxxxxxxx> CC: Andrew Jeffery <andrew@xxxxxxxx> CC: Joel Stanley <joel@xxxxxxxxx> CC: Andrew Baumann <Andrew.Baumann@xxxxxxxxxxxxx> CC: "Philippe Mathieu-Daudé" <philmd@xxxxxxxxxx> CC: Antony Pavlov <antonynpavlov@xxxxxxxxx> CC: Jean-Christophe Dubois <jcd@xxxxxxxxxxxxxxx> CC: Peter Chubb <peter.chubb@xxxxxxxxxxxx> CC: Subbaraya Sundeep <sundeep.lkml@xxxxxxxxx> CC: Eric Auger <eric.auger@xxxxxxxxxx> CC: Alistair Francis <alistair@xxxxxxxxxxxxx> CC: "Edgar E. Iglesias" <edgar.iglesias@xxxxxxxxx> CC: Stefano Stabellini <sstabellini@xxxxxxxxxx> CC: Anthony Perard <anthony.perard@xxxxxxxxxx> CC: Paul Durrant <paul@xxxxxxx> CC: Paul Burton <pburton@xxxxxxxxxxxx> CC: Aleksandar Rikalo <arikalo@xxxxxxxxxxxx> CC: Chris Wulff <crwulff@xxxxxxxxx> CC: Marek Vasut <marex@xxxxxxx> CC: David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> CC: Cornelia Huck <cohuck@xxxxxxxxxx> CC: Halil Pasic <pasic@xxxxxxxxxxxxx> CC: Christian Borntraeger <borntraeger@xxxxxxxxxx> CC: "Hervé Poussineau" <hpoussin@xxxxxxxxxxx> CC: Xiao Guangrong <xiaoguangrong.eric@xxxxxxxxx> CC: Aurelien Jarno <aurelien@xxxxxxxxxxx> CC: Aleksandar Markovic <amarkovic@xxxxxxxxxxxx> CC: Mark Cave-Ayland <mark.cave-ayland@xxxxxxxxxxxx> CC: Jason Wang <jasowang@xxxxxxxxxx> CC: Laszlo Ersek <lersek@xxxxxxxxxx> CC: Yuval Shaia <yuval.shaia@xxxxxxxxxx> CC: Palmer Dabbelt <palmer@xxxxxxxxxx> CC: Sagar Karandikar <sagark@xxxxxxxxxxxxxxxxx> CC: Bastian Koppelmann <kbastian@xxxxxxxxxxxxxxxxxxxxx> CC: David Hildenbrand <david@xxxxxxxxxx> CC: Thomas Huth <thuth@xxxxxxxxxx> CC: Eric Farman <farman@xxxxxxxxxxxxx> CC: Matthew Rosato <mjrosato@xxxxxxxxxxxxx> CC: Hannes Reinecke <hare@xxxxxxxx> CC: Michael Walle <michael@xxxxxxxx> CC: Artyom Tarasenko <atar4qemu@xxxxxxxxx> CC: Stefan Berger <stefanb@xxxxxxxxxxxxx> CC: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx> CC: Alex Williamson <alex.williamson@xxxxxxxxxx> CC: Tony Krowiak <akrowiak@xxxxxxxxxxxxx> CC: Pierre Morel <pmorel@xxxxxxxxxxxxx> CC: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx> CC: Hailiang Zhang <zhang.zhanghailiang@xxxxxxxxxx> CC: Juan Quintela <quintela@xxxxxxxxxx> CC: "Dr. David Alan Gilbert" <dgilbert@xxxxxxxxxx> CC: Luigi Rizzo <rizzo@xxxxxxxxxxxx> CC: Giuseppe Lettieri <g.lettieri@xxxxxxxxxxxx> CC: Vincenzo Maffione <v.maffione@xxxxxxxxx> CC: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> CC: Anthony Green <green@xxxxxxxxxxxxxx> CC: Stafford Horne <shorne@xxxxxxxxx> CC: Guan Xuetao <gxt@xxxxxxxxxxxxxxx> CC: Max Filippov <jcmvbkbc@xxxxxxxxx> CC: qemu-block@xxxxxxxxxx CC: integration@xxxxxxxxxxx CC: sheepdog@xxxxxxxxxxxxxx CC: qemu-arm@xxxxxxxxxx CC: xen-devel@xxxxxxxxxxxxxxxxxxxx CC: qemu-ppc@xxxxxxxxxx CC: qemu-s390x@xxxxxxxxxx CC: qemu-riscv@xxxxxxxxxx scripts/coccinelle/auto-propagated-errp.cocci | 118 ++++++++++++++++++ 1 file changed, 118 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..d9731620aa --- /dev/null +++ b/scripts/coccinelle/auto-propagated-errp.cocci @@ -0,0 +1,118 @@ +@rule0@ +// Add invocation to errp-functions where necessary +identifier fn, local_err; +symbol errp; +@@ + + fn(..., Error **errp, ...) + { ++ ERRP_AUTO_PROPAGATE(); + <+... +( + error_append_hint(errp, ...); +| + error_prepend(errp, ...); +| + Error *local_err = NULL; +) + ...+> + } + +@@ +// Drop doubled invocation +identifier rule0.fn; +@@ + + fn(...) +{ +- ERRP_AUTO_PROPAGATE(); + ERRP_AUTO_PROPAGATE(); + ... +} + +@rule1@ +// Drop local_err +identifier fn, local_err; +symbol errp; +@@ + + fn(..., Error **errp, ...) + { + <... +- Error *local_err = NULL; + ...> + } + +@@ +// Handle pattern with goto, otherwise we'll finish up +// with labels at function end which will not compile. +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_prepend(errp, local_err, ++ error_prepend(errp, + ...); +| +- error_propagate(errp, local_err); +) + ...> + } + +@@ +identifier rule1.fn; +identifier rule1.local_err; +@@ + + fn(...) + { + <... +( +- &local_err ++ errp +| +- local_err ++ *errp +) + ...> + } + +@@ +symbol errp; +@@ + +- *errp != NULL ++ *errp -- 2.21.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |