From 2dcd6bed6a97a5b8f6a1de36c176e7424170fa9b Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Mon, 17 Apr 2023 13:20:28 +0100 Subject: [PATCH] util: enforce unreachable()'s argument being a literal string MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This prevents the bugs fixed in the previous commits. Signed-off-by: Eric Engestrom Reviewed-by: Marek Olšák Part-of: --- src/util/macros.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/macros.h b/src/util/macros.h index 580fc8d..d79848a 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -122,17 +122,17 @@ #if defined(HAVE___BUILTIN_UNREACHABLE) || __has_builtin(__builtin_unreachable) #define unreachable(str) \ do { \ - assert(!str); \ + assert(!"" str); \ __builtin_unreachable(); \ } while (0) #elif defined (_MSC_VER) #define unreachable(str) \ do { \ - assert(!str); \ + assert(!"" str); \ __assume(0); \ } while (0) #else -#define unreachable(str) assert(!str) +#define unreachable(str) assert(!"" str) #endif /** -- 2.7.4