unicorn/qemu/include/qemu
Eric Blake 3017797f7d
osdep.h: Prohibit disabling assert() in supported builds
We already have several files that knowingly require assert()
to work, sometimes because refactoring the code for proper
error handling has not been tackled yet; there are probably
other files that have a similar situation but with no comments
documenting the same. In fact, we have places in migration
that handle untrusted input with assertions, where disabling
the assertions risks a worse security hole than the current
behavior of losing the guest to SIGABRT when migration fails
because of the assertion. Promote our current per-file
safety-valve to instead be project-wide, and expand it to also
cover glib's g_assert().

Note that we do NOT want to encourage 'assert(side-effects);'
(that is a bad practice that prevents copy-and-paste of code to
other projects that CAN disable assertions; plus it costs
unnecessary reviewer mental cycles to remember whether a project
special-cases the crippling of asserts); and we would LIKE to
fix migration to not rely on asserts (but that takes a big code
audit). But in the meantime, we DO want to send a message
that anyone that disables assertions has to tweak code in order
to compile, making it obvious that they are taking on additional
risk that we are not going to support. At the same time, leave
comments mentioning NDEBUG in files that we know still need to
be scrubbed, so there is at least something to grep for.

It would be possible to come up with some other mechanism for
doing runtime checking by default, but which does not abort
the program on failure, while leaving side effects in place
(unlike how crippling assert() avoids even the side effects),
perhaps under the name q_verify(); but it was not deemed worth
the effort (developers should not have to learn a replacement
when the standard C macro works just fine, and it would be a lot
of churn for little gain). The patch specifically uses #error
rather than #warn so that a user is forced to tweak the header
to acknowledge the issue, even when not using a -Werror
compilation.

Backports commit 262a69f4282e44426c7a132138581d400053e0a1 from qemu
2018-03-05 00:01:57 -05:00
..
atomic.h qemu/atomic: Loosen restrictions for 64-bit ILP32 hosts 2018-03-02 20:06:39 -05:00
bitmap.h bitmap: add bitmap_copy_and_clear_atomic 2018-03-02 18:59:11 -05:00
bitops.h bitops: Add MAKE_64BIT_MASK macro 2018-02-25 00:30:39 -05:00
bswap.h bswap.h: Document cpu_to_* and *_to_cpu conversion functions 2018-02-25 04:06:28 -05:00
compiler.h Drop QEMU_GNUC_PREREQ() checks for gcc older than 4.1 2018-03-02 18:59:05 -05:00
crc32c.h import 2015-08-21 15:04:50 +08:00
cutils.h util/cutils: Change qemu_strtosz*() from int64_t to uint64_t 2018-03-02 08:58:55 -05:00
fprintf-fn.h Clean up decorations and whitespace around header guards 2018-02-25 04:26:02 -05:00
host-utils.h Drop QEMU_GNUC_PREREQ() checks for gcc older than 4.1 2018-03-02 18:59:05 -05:00
int128.h tcg: Add atomic128 helpers 2018-02-27 21:43:48 -05:00
log.h tcg: Lower indirect registers in a separate pass 2018-02-25 22:32:28 -05:00
mmap-alloc.h Clean up ill-advised or unusual header guards 2018-02-25 04:22:46 -05:00
module.h cleanup qemu/include/qemu/module.h 2017-01-25 00:20:08 +08:00
osdep.h osdep.h: Prohibit disabling assert() in supported builds 2018-03-05 00:01:57 -05:00
queue.h Clean up ill-advised or unusual header guards 2018-02-25 04:22:46 -05:00
range.h range: Replace internal representation of Range 2018-02-25 00:44:36 -05:00
thread-posix.h Clean up ill-advised or unusual header guards 2018-02-25 04:22:46 -05:00
thread-win32.h Clean up ill-advised or unusual header guards 2018-02-25 04:22:46 -05:00
thread.h Clean up ill-advised or unusual header guards 2018-02-25 04:22:46 -05:00
timer.h include: move CPU-related definitions out of qemu-common.h 2018-02-24 00:33:49 -05:00
typedefs.h exec: introduce MemoryRegionCache 2018-03-01 10:50:30 -05:00