On 03/03/2017 01:47 PM, Eric Blake wrote: > On 03/03/2017 01:35 PM, Richard Henderson wrote: >> >> Which is exactly the point when you have a condition like (X > 0); >> letting the compiler have the same information for the production build >> that it would have gleaned from the debug build. >> >> But that's not the same as dropping the assert, which is what you wanted. >> >> On the other hand, isn't "assert" instead of "g_assert" exactly what you >> wanted? Don't we define NDEBUG for production builds? > > No - no one in their right mind defines NDEBUG for qemu. For better or > worse, there are too many places where we liberally use assert(), and > where the code WILL crash and burn when it falls through to subsequent > code if a failed assert() is not equivalent to a fatal exit. (I still > try to make sure we avoid any new side-effects in assert in my code > reviews, but there's no way you'll convince me to audit the code base > for NDEBUG-safety violations).
A quick git grep shows, among others: hw/scsi/mptsas.c: * When we do, we might be able to re-enable NDEBUG below. hw/scsi/mptsas.c:#ifdef NDEBUG hw/scsi/mptsas.c:#error building with NDEBUG is not supported hw/virtio/virtio.c: * When we do, we might be able to re-enable NDEBUG below. hw/virtio/virtio.c:#ifdef NDEBUG hw/virtio/virtio.c:#error building with NDEBUG is not supported -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature