From: Fam Zheng <famz@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Markus Armbruster <armbru@redhat.com>,
QEMU Developers <qemu-devel@nongnu.org>,
Anthony Liguori <aliguori@amazon.com>,
Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] qapi-commands.py generates code that uses uninitialized variables
Date: Fri, 11 Apr 2014 15:48:02 +0800 [thread overview]
Message-ID: <20140411074801.GA31773@T430.nay.redhat.com> (raw)
In-Reply-To: <CAFEAcA_SzS-Hj98x-OkrijJrTxLyO57jnHWwWt_NW=MS6wVQUA@mail.gmail.com>
On Fri, 04/11 08:27, Peter Maydell wrote:
> On 11 April 2014 02:40, Eric Blake <eblake@redhat.com> wrote:
> > We uncovered a real bug that would be fixed by this patch:
> > https://lists.gnu.org/archive/html/qemu-devel/2014-04/msg01745.html
>
> No, that's a bug in the called code. The API here defines
> that for optional parameters, if the have_foo bool is false
> then the foo argument isn't set. The generated code
> can't know the correct default value (it just happens
> to be 0 in the case you point out, but what if the default
> speed were 100?) so this must be handled by the called
> code.
>
Default value for a variable isn't default value for API logic, so apparently
called code must always handle both have_foo and foo. But there is a point to
take this patch from the language perspective, to avoid that an unset variable
is passed as a parameter from generated code.
Thanks,
Fam
next prev parent reply other threads:[~2014-04-11 7:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-17 23:58 [Qemu-devel] qapi-commands.py generates code that uses uninitialized variables Peter Maydell
2014-03-18 9:32 ` Markus Armbruster
2014-03-20 19:21 ` Michael Roth
2014-03-26 14:34 ` Markus Armbruster
2014-03-28 14:19 ` Peter Maydell
2014-04-11 1:40 ` Eric Blake
2014-04-11 7:27 ` Peter Maydell
2014-04-11 7:48 ` Fam Zheng [this message]
2014-04-11 13:11 ` Eric Blake
2014-04-11 13:27 ` Peter Maydell
2014-04-11 14:01 ` Laszlo Ersek
2014-05-20 11:46 ` Peter Maydell
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=20140411074801.GA31773@T430.nay.redhat.com \
--to=famz@redhat.com \
--cc=aliguori@amazon.com \
--cc=armbru@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=peter.maydell@linaro.org \
--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).