[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v7 28/38] libqtest: Add qtest_[v]startf()
From: |
Thomas Huth |
Subject: |
Re: [Qemu-devel] [PATCH v7 28/38] libqtest: Add qtest_[v]startf() |
Date: |
Wed, 13 Sep 2017 09:19:00 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
On 12.09.2017 15:32, Eric Blake wrote:
> On 09/12/2017 05:14 AM, Thomas Huth wrote:
>> On 11.09.2017 19:20, Eric Blake wrote:
>>> We have several callers that were formatting the argument strings
>>> themselves; consolidate this effort by adding new convenience
>>> functions directly in libqtest, and update all call-sites that
>>> can benefit from it.
[...]
>>> static void test_mon_partial(const void *data)
>>> {
>>> char *s;
>>> - char *cli;
>>> + const char *args = data;
>>>
>>> - cli = make_cli(data, "-smp 8 "
>>> - "-numa node,nodeid=0,cpus=0-1 "
>>> - "-numa node,nodeid=1,cpus=4-5 ");
>>> - qtest_start(cli);
>>> + global_qtest = qtest_startf("%s -smp 8 "
>>> + "-numa node,nodeid=0,cpus=0-1 "
>>> + "-numa node,nodeid=1,cpus=4-5 ", args);
>>
>> Does GCC emit a warning if you'd used data here directly? Otherwise I
>> think you could simply do this without the local args variable...
>
> Passing void* through varargs, with the intent of the receiver parsing
> it as char*, is technically undefined in C. I don't know if gcc warns,
> but I'm also worried that clang might warn. I prefer to err on the side
> of defined behavior in this case, even though it annoyingly requires a
> temporary variable.
OK, sounds reasonable, so let's keep it!
Thomas
signature.asc
Description: OpenPGP digital signature
[Qemu-devel] [PATCH v7 33/38] libqtest: Merge qtest_{in, out}[bwl]() with {in, out}[bwl](), Eric Blake, 2017/09/11