conf: force 8 byte alignment for virObjectEvent
We need to be able to cast from virObjectEventPtr to one of its many subclasses. Some of these subclasses have 8 byte alignment on 32-bit platforms, but virObjectEventPtr only has 4 byte alignment. Previously the virObject base class had 8 byte alignment but this dropped to 4 byte when converted to inherit from GObject. This introduces cast alignment warnings on 32-bit: ../../src/conf/domain_event.c: In function 'virDomainEventDispatchDefaultFunc': ../../src/conf/domain_event.c:1656:30: error: cast increases required alignment of target type [-Werror=cast-align] 1656 | rtcChangeEvent = (virDomainEventRTCChangePtr)event; | ^ ../../src/conf/domain_event.c:1785:34: error: cast increases required alignment of target type [-Werror=cast-align] 1785 | balloonChangeEvent = (virDomainEventBalloonChangePtr)event; | ^ ../../src/conf/domain_event.c:1896:35: error: cast increases required alignment of target type [-Werror=cast-align] 1896 | blockThresholdEvent = (virDomainEventBlockThresholdPtr)event; | ^ ../../src/conf/domain_event.c: In function 'virDomainQemuMonitorEventDispatchFunc': ../../src/conf/domain_event.c:1974:24: error: cast increases required alignment of target type [-Werror=cast-align] 1974 | qemuMonitorEvent = (virDomainQemuMonitorEventPtr)event; | ^ ../../src/conf/domain_event.c: In function 'virDomainQemuMonitorEventFilter': ../../src/conf/domain_event.c:2179:20: error: cast increases required alignment of target type [-Werror=cast-align] 2179 | monitorEvent = (virDomainQemuMonitorEventPtr) event; | ^ Forcing 8-byte alignment on virObjectEventPtr removes the alignment increase during casts to subclasses. Reviewed-by: NPavel Hrdina <phrdina@redhat.com> Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
Showing
想要评论请 注册 或 登录