ref: c0e1988b0118531fbe264a3e6143ca9cc2e311fc
parent: 666c71a04056724ce73a80a9113ce505a08f8595
author: Henrik Gramner <gramner@twoorioles.com>
date: Wed Sep 4 10:31:22 EDT 2019
Prefer __builtin_unreachable() over __assume() on clang-cl __assume() doesn't work correctly in clang-cl versions prior to 7.0.0 which causes bogus warnings regarding use of uninitialized variables to be printed. Avoid that by using __builtin_unreachable() instead.
--- a/include/common/attributes.h
+++ b/include/common/attributes.h
@@ -92,7 +92,7 @@
#define NOINLINE __attribute__((noinline))
#endif /* !_MSC_VER */
-#if defined(NDEBUG) && defined(__GNUC__)
+#if defined(NDEBUG) && (defined(__GNUC__) || defined(__clang__))
#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
#elif defined(NDEBUG) && defined(_MSC_VER)
#define assert __assume