Re: [kvm-unit-tests PATCH] lib: use an argument which doesn't require default argument promotion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 14/10/2019 13.04, Paolo Bonzini wrote:
> On 14/10/19 09:57, Thomas Huth wrote:
>> -void report(const char *msg_fmt, bool pass, ...)
>> +void report(bool pass, const char *msg_fmt, ...)
>>  {
>>         va_list va;
>> -       va_start(va, pass);
>> +       va_start(va, msg_fmt);
>>         va_report(msg_fmt, pass, false, false, va);
>>         va_end(va);
>>  }
>>
>> -void report_xfail(const char *msg_fmt, bool xfail, bool pass, ...)
>> +void report_xfail(bool xfail, bool pass, const char *msg_fmt, ...)
>>  {
>>         va_list va;
>> -       va_start(va, pass);
>> +       va_start(va, msg_fmt);
>>         va_report(msg_fmt, pass, xfail, false, va);
>>         va_end(va);
>>  }
>>
>> ... then we can keep the "bool" - but we have to fix all calling sites, too.
>>
>> Paolo, any preferences?
> 
> Actually I had already pushed Bill's patch.  I also thought about
> reordering the arguments, but it's a big change.  If someone wants to
> try his hands at doing it with Coccinelle, I'm happy to apply it.

This coccinelle script seems to do the job:

@@
expression fmt;
expression pass;
expression list args;
@@
 report(
-fmt, pass
+pass, fmt
 , args);

@@
expression fmt;
expression pass;
expression list args;
@@
 report_xfail(
-fmt, xfail, pass
+xfail, pass, fmt
 , args);

I'll try to cook a patch with that.

 Thomas



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux