[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/16] qemu/compiler.h: Add qemu_build_not_reached
From: |
Richard Henderson |
Subject: |
[PULL 03/16] qemu/compiler.h: Add qemu_build_not_reached |
Date: |
Wed, 25 Sep 2019 11:45:35 -0700 |
Use this as a compile-time assert that a particular
code path is not reachable.
Reviewed-by: Alex Bennée <address@hidden>
Signed-off-by: Richard Henderson <address@hidden>
---
include/qemu/compiler.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index 20780e722d..7b93c73340 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -221,4 +221,19 @@
#define QEMU_GENERIC9(x, a0, ...) QEMU_GENERIC_IF(x, a0, QEMU_GENERIC8(x,
__VA_ARGS__))
#define QEMU_GENERIC10(x, a0, ...) QEMU_GENERIC_IF(x, a0, QEMU_GENERIC9(x,
__VA_ARGS__))
+/**
+ * qemu_build_not_reached()
+ *
+ * The compiler, during optimization, is expected to prove that a call
+ * to this function cannot be reached and remove it. If the compiler
+ * supports QEMU_ERROR, this will be reported at compile time; otherwise
+ * this will be reported at link time due to the missing symbol.
+ */
+#ifdef __OPTIMIZE__
+extern void QEMU_NORETURN QEMU_ERROR("code path is reachable")
+ qemu_build_not_reached(void);
+#else
+#define qemu_build_not_reached() g_assert_not_reached()
+#endif
+
#endif /* COMPILER_H */
--
2.17.1
- [PULL 00/16] tcg patch queue, Richard Henderson, 2019/09/25
- [PULL 01/16] exec: Use TARGET_PAGE_BITS_MIN for TLB flags, Richard Henderson, 2019/09/25
- [PULL 02/16] cputlb: Disable __always_inline__ without optimization, Richard Henderson, 2019/09/25
- [PULL 03/16] qemu/compiler.h: Add qemu_build_not_reached,
Richard Henderson <=
- [PULL 04/16] cputlb: Use qemu_build_not_reached in load/store_helpers, Richard Henderson, 2019/09/25
- [PULL 05/16] cputlb: Split out load/store_memop, Richard Henderson, 2019/09/25
- [PULL 06/16] cputlb: Introduce TLB_BSWAP, Richard Henderson, 2019/09/25
- [PULL 07/16] exec: Adjust notdirty tracing, Richard Henderson, 2019/09/25
- [PULL 09/16] cputlb: Move NOTDIRTY handling from I/O path to TLB path, Richard Henderson, 2019/09/25
- [PULL 08/16] cputlb: Move ROM handling from I/O path to TLB path, Richard Henderson, 2019/09/25
- [PULL 11/16] cputlb: Merge and move memory_notdirty_write_{prepare, complete}, Richard Henderson, 2019/09/25
- [PULL 12/16] cputlb: Handle TLB_NOTDIRTY in probe_access, Richard Henderson, 2019/09/25
- [PULL 10/16] cputlb: Partially inline memory_region_section_get_iotlb, Richard Henderson, 2019/09/25
- [PULL 13/16] cputlb: Remove cpu->mem_io_vaddr, Richard Henderson, 2019/09/25