On 12/11/2013 06:18 AM, Michal Privoznik wrote: > > I'm getting some compile errors on ARM: > > CC conf/libvirt_conf_la-domain_event.lo > conf/domain_event.c: In function 'virDomainEventDispatchDefaultFunc': > conf/domain_event.c:1148:30: error: cast increases required alignment of > target type [-Werror=cast-align] > rtcChangeEvent = (virDomainEventRTCChangePtr)event; Hmm. In this case, event is virObjectEventPtr, and rtcChangeEvent is virDomainEventRTCChangePtr. Comparing the two structs, I see the problem: struct _virObjectEvent { virObject parent; int eventID; virObjectMeta meta; }; Only has alignment specified by virObject (which in turn is unsigned int, int, void*), int, and virObjectMeta (which in turn is int, char*, unsigned char[]). vs. struct _virDomainEventRTCChange { virDomainEvent parent; long long offset; }; I think one possible solution would be as simple as altering src/util/virobject.h to change 'magic' from 'unsigned int' to 'unsigned long long' - then ALL virObject structs will be forcefully aligned to the worst case between void* and long long, so that any subclass can use long long without requiring stricter alignment than the parent class, and so that downcasting code like domain_event.c no longer warns. But it does make every object consume more memory on 64-bit platforms (from 16 bytes into 24 bytes), is that okay? -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list