Re: [libvirt] [PATCH 03/21] tests: qemuxml2argv: add va_arg enum handling

2019-03-21 Thread Cole Robinson
On 3/19/19 7:36 AM, Andrea Bolognani wrote: > On Thu, 2019-03-14 at 10:43 -0400, Cole Robinson wrote: > [...] >> +typedef enum { >> +ARG_QEMU_CAPS = 1, > > Any specific reason to start from 1 rather than 0, or even leaving > out the start value entirely? > Nope it's not necessary, I've

Re: [libvirt] [PATCH 03/21] tests: qemuxml2argv: add va_arg enum handling

2019-03-19 Thread Andrea Bolognani
On Fri, 2019-03-15 at 14:47 -0400, Cole Robinson wrote: > On 3/14/19 4:29 PM, Eric Blake wrote: > > On 3/14/19 2:42 PM, Cole Robinson wrote: > > > The double sentinel is actually a requirement of the current code, > > > because once we see ARG_QEMU_CAPS, we pass off the va_list to > > >

Re: [libvirt] [PATCH 03/21] tests: qemuxml2argv: add va_arg enum handling

2019-03-19 Thread Andrea Bolognani
On Thu, 2019-03-14 at 10:43 -0400, Cole Robinson wrote: [...] > +typedef enum { > +ARG_QEMU_CAPS = 1, Any specific reason to start from 1 rather than 0, or even leaving out the start value entirely? > + > +ARG_END = QEMU_CAPS_LAST, > +} testInfoArgNames; The name of the enum should be

Re: [libvirt] [PATCH 03/21] tests: qemuxml2argv: add va_arg enum handling

2019-03-15 Thread Cole Robinson
On 3/14/19 4:29 PM, Eric Blake wrote: On 3/14/19 2:42 PM, Cole Robinson wrote: +typedef enum { +    ARG_QEMU_CAPS = 1, + +    ARG_END = QEMU_CAPS_LAST, +} testInfoArgNames; + Do you need some sort of compile-time check that QEMU_CAPS_LAST doesn't overlap with any other ARG_*? Sure but

Re: [libvirt] [PATCH 03/21] tests: qemuxml2argv: add va_arg enum handling

2019-03-14 Thread Eric Blake
On 3/14/19 2:42 PM, Cole Robinson wrote: >> >>> +typedef enum { >>> +    ARG_QEMU_CAPS = 1, >>> + >>> +    ARG_END = QEMU_CAPS_LAST, >>> +} testInfoArgNames; >>> + Do you need some sort of compile-time check that QEMU_CAPS_LAST doesn't overlap with any other ARG_*? >>> +    while ((argname =

Re: [libvirt] [PATCH 03/21] tests: qemuxml2argv: add va_arg enum handling

2019-03-14 Thread Cole Robinson
On 3/14/19 11:23 AM, Eric Blake wrote: On 3/14/19 9:43 AM, Cole Robinson wrote: This establishes a pattern that will allow us to make test macros more general purpose, by taking optional arguments. The general format will be: DO_TEST_FULL(... ARG_FOO, , ARG_BAR, )

Re: [libvirt] [PATCH 03/21] tests: qemuxml2argv: add va_arg enum handling

2019-03-14 Thread Eric Blake
On 3/14/19 9:43 AM, Cole Robinson wrote: > This establishes a pattern that will allow us to make test macros > more general purpose, by taking optional arguments. The general > format will be: > > DO_TEST_FULL(... > ARG_FOO, , > ARG_BAR, ) > > ARG_X are just enum values

[libvirt] [PATCH 03/21] tests: qemuxml2argv: add va_arg enum handling

2019-03-14 Thread Cole Robinson
This establishes a pattern that will allow us to make test macros more general purpose, by taking optional arguments. The general format will be: DO_TEST_FULL(... ARG_FOO, , ARG_BAR, ) ARG_X are just enum values that we look for in the va_args and know how to interpret.