virdbus: don't force users to pass int for bool values
A message that is not in the archive (sent off-list or not yet received): 20141120101240.2a75f384@m
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 19 lines · Eric Blake
Quoted 13 lines · Eric Blake
Quoted 11 lines · Conrad Meyer
Hi Eric,
I think this change breaks build on FreeBSD:
CC util/libvirt_util_la-virdbus.lo
util/virdbus.c:956:13: error: cast from 'bool *' to 'dbus_bool_t*' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align]GET_NEXT_VAL(dbus_bool_t, bool_val, bool, "%d"); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ util/virdbus.c:858:17: note: expanded from macro 'GET_NEXT_VAL' x = (dbustype *)(*xptrptr + (*narrayptr - 1)); \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.Quoted 2 lines
Valid complaint, so I'll have to figure something out to avoid it. :( Thanks for the heads up.
Thanks again for flagging this!
Quoted 7 lines
We had a pre-existing bug. Even something like "a&n" was broken on encoding, because even though type 'n' (
int16_t) promotes to a full 'int' when parsed via varargs, passing an array of shorts and then dereferencing it via (int*) will read beyond array bounds. We had a hole in our testsuite for never testing arrayref with sub-int types, even before my commit added 'bool *' to the list of sub-int types that we now need to support.
I'm, guessing that this is the same underlying issue as:
util/virdbus.c: In function 'virDBusMessageIterDecode':
util/virdbus.c:956:346: error: cast increases required alignment of target type [-Werror=cast-align]
which we are seeing in the Xen automated tests [0, 1] (on armhf only, probably compiler dependent?).
Ian.
[0] http://www.chiark.greenend.org.uk/~xensrcts/logs/31787/build-armhf-libvirt/5.ts-libvirt-build.log
[1] http://www.chiark.greenend.org.uk/~xensrcts/logs/31787/build-armhf-libvirt/info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 11 lines · Ian Campbell
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
I think this change breaks build on FreeBSD:
CC util/libvirt_util_la-virdbus.lo
util/virdbus.c:956:13: error: cast from 'bool *' to 'dbus_bool_t*' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align]GET_NEXT_VAL(dbus_bool_t, bool_val, bool, "%d"); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ util/virdbus.c:858:17: note: expanded from macro 'GET_NEXT_VAL' x = (dbustype *)(*xptrptr + (*narrayptr - 1)); \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Valid complaint, so I'll have to figure something out to avoid it. :(
I'm, guessing that this is the same underlying issue as:
util/virdbus.c: In function 'virDBusMessageIterDecode':
util/virdbus.c:956:346: error: cast increases required alignment of target type [-Werror=cast-align]
Yes.
Quoted 3 lines
which we are seeing in the Xen automated tests [0, 1] (on armhf only, probably compiler dependent?).
So, do I have an ACK on my proposed fix yet? :)
https://www.redhat.com/archives/libvir-list/2014-November/msg00838.html
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
A message that is not in the archive (sent off-list or not yet received): [email protected]
Ian Campbell
Acked-byQuoted 19 lines · Eric Blake
Quoted 11 lines · Ian Campbell
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
I think this change breaks build on FreeBSD:
CC util/libvirt_util_la-virdbus.lo
util/virdbus.c:956:13: error: cast from 'bool *' to 'dbus_bool_t*' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align]GET_NEXT_VAL(dbus_bool_t, bool_val, bool, "%d"); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ util/virdbus.c:858:17: note: expanded from macro 'GET_NEXT_VAL' x = (dbustype *)(*xptrptr + (*narrayptr - 1)); \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.Quoted 5 lines
Quoted 1 line
Quoted 1 line
Valid complaint, so I'll have to figure something out to avoid it. :(
I'm, guessing that this is the same underlying issue as:
util/virdbus.c: In function 'virDBusMessageIterDecode':
util/virdbus.c:956:346: error: cast increases required alignment of target type [-Werror=cast-align]
Quoted 8 lines
Yes.
Quoted 3 lines
which we are seeing in the Xen automated tests [0, 1] (on armhf only, probably compiler dependent?).
So, do I have an ACK on my proposed fix yet? :)
https://www.redhat.com/archives/libvir-list/2014-November/msg00838.html
Well, FWIW it looks good to me:
Ian.