
On 11.12.2013 20:28, Eric Blake wrote:
On 12/11/2013 12:15 PM, Eric Blake wrote:
struct _virObjectEvent { virObject parent; int eventID; virObjectMeta meta; };
Only has alignment specified by virObject (which in turn is unsigned int, int, void*),
struct _virObject { unsigned int magic; int refs; virClassPtr klass; };
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?
Or maybe even change _virObject to contain a union:
struct _virObject { union { long long align; struct { unsigned int magic; int refs; } s; } u; virClassPtr klass; }
Yep. I can confirm that this works. This and all the subsequent code adaptations made me able to compile again. Will you post it as a patch please? Michal