On 08/20/2012 10:57 AM, Daniel P. Berrange wrote:
>> + if (STRNEQ_NULLABLE(info[i]->alias, (wantalias)))
{ \
>> + virReportError(VIR_ERR_INTERNAL_ERROR, \
>> + "alias %s is not %s",
\
>> + info[i]->alias, NULLSTR(wantalias)); \
>> + goto cleanup; \
>> + } \
>> + } while (0)
>> +
>> + CHECK(0, "pc-1.0", false, null);
>
> Can't you just s/null/NULL/ and avoid the intermediate variable?
I hit some GCC-wierdness when doing that:
CC qemumonitorjsontest-qemumonitorjsontest.o
qemumonitorjsontest.c: In function 'testQemuMonitorJSONGetMachines':
qemumonitorjsontest.c:289:5: error: null argument where non-null required (argument 1)
[-Werror=nonnull]
qemumonitorjsontest.c:289:5: error: null argument where non-null required (argument 1)
[-Werror=nonnull]
qemumonitorjsontest.c:289:5: error: null argument where non-null required (argument 2)
[-Werror=nonnull]
qemumonitorjsontest.c:289:5: error: null argument where non-null required (argument 2)
[-Werror=nonnull]
qemumonitorjsontest.c:289:5: error: null argument where non-null required (argument 1)
[-Werror=nonnull]
qemumonitorjsontest.c:289:5: error: null argument where non-null required (argument 1)
[-Werror=nonnull]
qemumonitorjsontest.c:289:5: error: null argument where non-null required (argument 2)
[-Werror=nonnull]
qemumonitorjsontest.c:289:5: error: null argument where non-null required (argument 2)
[-Werror=nonnull]
qemumonitorjsontest.c:289:5: error: invalid application of 'sizeof' to a void
type [-Werror=pointer-arith]
That argues that our STRNEQ_NULLABLE and NULLSTR macros should be made a
bit smarter. I'll play with it, to see if I can reproduce; what gcc
version were you using?
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org