qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: armbru@redhat.com, berrange@redhat.com,
	Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH v9 06/17] qapi: Drop useless gen_err_check()
Date: Wed, 13 Jul 2016 21:50:17 -0600	[thread overview]
Message-ID: <1468468228-27827-7-git-send-email-eblake@redhat.com> (raw)
In-Reply-To: <1468468228-27827-1-git-send-email-eblake@redhat.com>

Ever since commit 12f254f removed the last parameterization
of gen_err_check(), it no longer makes sense to hide the three
lines of generated C code behind a macro call. Just inline it
into the remaining users.

No change to generated code.

Signed-off-by: Eric Blake <eblake@redhat.com>

---
v9: new patch
v8: new patch
---
 scripts/qapi.py          | 8 --------
 scripts/qapi-commands.py | 4 +++-
 scripts/qapi-visit.py    | 8 ++++++--
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/scripts/qapi.py b/scripts/qapi.py
index 27284be..9c48f6d 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -1656,14 +1656,6 @@ def gen_params(arg_type, extra):
     return ret


-def gen_err_check():
-    return mcgen('''
-    if (err) {
-        goto out;
-    }
-''')
-
-
 #
 # Common command line parsing
 #
diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py
index c93470c..333a46f 100644
--- a/scripts/qapi-commands.py
+++ b/scripts/qapi-commands.py
@@ -46,8 +46,10 @@ def gen_call(name, arg_type, ret_type):
 ''',
                 c_name=c_name(name), args=argstr, lhs=lhs)
     if ret_type:
-        ret += gen_err_check()
         ret += mcgen('''
+    if (err) {
+        goto out;
+    }

     qmp_marshal_output_%(c_name)s(retval, ret, &err);
 ''',
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
index 0b9e298..96f2491 100644
--- a/scripts/qapi-visit.py
+++ b/scripts/qapi-visit.py
@@ -47,9 +47,11 @@ void visit_type_%(c_name)s_members(Visitor *v, %(c_name)s *obj, Error **errp)
     if base:
         ret += mcgen('''
     visit_type_%(c_type)s_members(v, (%(c_type)s *)obj, &err);
+    if (err) {
+        goto out;
+    }
 ''',
                      c_type=base.c_name())
-        ret += gen_err_check()

     for memb in members:
         if memb.optional:
@@ -60,10 +62,12 @@ void visit_type_%(c_name)s_members(Visitor *v, %(c_name)s *obj, Error **errp)
             push_indent()
         ret += mcgen('''
     visit_type_%(c_type)s(v, "%(name)s", &obj->%(c_name)s, &err);
+    if (err) {
+        goto out;
+    }
 ''',
                      c_type=memb.type.c_name(), name=memb.name,
                      c_name=c_name(memb.name))
-        ret += gen_err_check()
         if memb.optional:
             pop_indent()
             ret += mcgen('''
-- 
2.5.5

  parent reply	other threads:[~2016-07-14  3:50 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-14  3:50 [Qemu-devel] [PATCH for-2.7 v9 00/17] qapi netdev_add introspection (post-introspection cleanups subset F) Eric Blake
2016-07-14  3:50 ` [Qemu-devel] [PATCH v9 01/17] net: use Netdev instead of NetClientOptions in client init Eric Blake
2016-07-14  3:50 ` [Qemu-devel] [PATCH v9 02/17] qapi: Require all branches of flat union enum to be covered Eric Blake
2016-07-14  3:50 ` [Qemu-devel] [PATCH v9 03/17] qapi: Special case c_name() for empty type Eric Blake
2016-07-14  3:50 ` [Qemu-devel] [PATCH v9 04/17] qapi: Hide tag_name data member of variants Eric Blake
2016-07-14  3:50 ` [Qemu-devel] [PATCH v9 05/17] qapi: Add type.is_empty() helper Eric Blake
2016-07-14  3:50 ` Eric Blake [this message]
2016-07-14  3:50 ` [Qemu-devel] [PATCH v9 07/17] qapi-event: Simplify visit of non-implicit data Eric Blake
2016-07-14  3:50 ` [Qemu-devel] [PATCH v9 08/17] qapi: Plumb in 'boxed' to qapi generator lower levels Eric Blake
2016-07-14 14:17   ` Markus Armbruster
2016-07-14  3:50 ` [Qemu-devel] [PATCH v9 09/17] qapi: Implement boxed types for commands/events Eric Blake
2016-07-14 14:26   ` Markus Armbruster
2016-07-14 16:23     ` Eric Blake
2016-07-14  3:50 ` [Qemu-devel] [PATCH v9 10/17] block: Simplify block_set_io_throttle Eric Blake
2016-07-14  3:50 ` [Qemu-devel] [PATCH v9 11/17] block: Simplify drive-mirror Eric Blake
2016-07-14 22:28   ` Eric Blake
2016-07-14 22:37     ` [Qemu-devel] [PATCH v9.5 " Eric Blake
2016-07-14  3:50 ` [Qemu-devel] [PATCH v9 12/17] qapi: Change Netdev into a flat union Eric Blake
2016-07-14  3:50 ` [Qemu-devel] [PATCH v9 13/17] net: Use correct type for bool flag Eric Blake
2016-07-14  3:50 ` [Qemu-devel] [PATCH v9 14/17] net: Complete qapi-fication of netdev_add Eric Blake
2016-07-14  3:50 ` [Qemu-devel] [PATCH v9 15/17] option: make parse_option_bool/number non-static Eric Blake
2016-07-14  3:50 ` [Qemu-devel] [PATCH v9 16/17] qapi: Tweak QmpInputVisitor to optionally do string conversion Eric Blake
2016-07-14  8:04   ` Daniel P. Berrange
2016-07-14 12:43     ` Eric Blake
2016-07-14 13:03       ` Daniel P. Berrange
2016-07-14 14:04         ` Eric Blake
2016-07-14 14:16           ` Daniel P. Berrange
2016-07-14 14:25             ` Eric Blake
2016-07-14  3:50 ` [Qemu-devel] [PATCH v9 17/17] qapi: Restore autocast behavior in 'netdev_add' Eric Blake
2016-07-14 16:42 ` [Qemu-devel] [PATCH for-2.7 v9 00/17] qapi netdev_add introspection (post-introspection cleanups subset F) Markus Armbruster
2016-07-15  7:13   ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1468468228-27827-7-git-send-email-eblake@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).