qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Stefan Berger" <stefanb@linux.vnet.ibm.com>,
	"Michael Roth" <michael.roth@amd.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Eric Blake" <eblake@redhat.com>
Subject: [RFC PATCH v2 1/2] qapi: Inline qmp_marshal_output() functions
Date: Wed,  9 Jun 2021 20:49:54 +0200	[thread overview]
Message-ID: <20210609184955.1193081-2-philmd@redhat.com> (raw)
In-Reply-To: <20210609184955.1193081-1-philmd@redhat.com>

In case we need to use QAPI types but no QAPI command / QAPI event
actually use them, the generated qmp_marshal_output() function will
trigger the compiler 'unused-function' warnings.
To prevent that, emit these functions inlined: the compiler will
ignore such unused functions.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
RFC: No clue about QAPI...
Tested with GCC. If the compiler is picky we could use the 'unused'
function attribute.
---
 scripts/qapi/commands.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py
index 0e13d510547..bbed776a909 100644
--- a/scripts/qapi/commands.py
+++ b/scripts/qapi/commands.py
@@ -91,8 +91,8 @@ def gen_call(name: str,
 def gen_marshal_output(ret_type: QAPISchemaType) -> str:
     return mcgen('''
 
-static void qmp_marshal_output_%(c_name)s(%(c_type)s ret_in,
-                                QObject **ret_out, Error **errp)
+static inline void qmp_marshal_output_%(c_name)s(%(c_type)s ret_in,
+                                        QObject **ret_out, Error **errp)
 {
     Visitor *v;
 
-- 
2.31.1



  reply	other threads:[~2021-06-09 18:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09 18:49 [PATCH v2 0/2] tpm: Return QMP error when TPM is disabled in build Philippe Mathieu-Daudé
2021-06-09 18:49 ` Philippe Mathieu-Daudé [this message]
2021-06-09 20:29   ` [RFC PATCH v2 1/2] qapi: Inline qmp_marshal_output() functions Eric Blake
2021-06-10  9:33     ` Markus Armbruster
2021-06-10 10:06       ` Philippe Mathieu-Daudé
2021-06-10 11:06         ` Markus Armbruster
2021-06-10 15:59           ` Philippe Mathieu-Daudé
2021-06-11  8:02             ` Markus Armbruster
2021-06-11 12:32               ` Stefan Berger
2021-06-09 18:49 ` [PATCH v2 2/2] tpm: Return QMP error when TPM is disabled in build Philippe Mathieu-Daudé
2021-06-09 20:33   ` Eric Blake
2021-06-10  9:35   ` 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=20210609184955.1193081-2-philmd@redhat.com \
    --to=philmd@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanb@linux.vnet.ibm.com \
    /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).