From 85a96d1e06a78357e94bd4eed1dd914f35cc7210 Mon Sep 17 00:00:00 2001 From: Quantum Date: Fri, 13 Aug 2021 19:43:51 -0400 Subject: [PATCH] [client] all: use DEBUG_UNREACHABLE instead of assert Due to the way assert is defined in standard C, compilers in release mode will not treat it as unreachable. This explains a lot about those pesky uninitialized variable bugs, actually. --- client/renderers/EGL/cursor.c | 2 +- client/renderers/EGL/egl.c | 3 +-- client/src/core.c | 3 +-- client/src/util.c | 3 +-- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/client/renderers/EGL/cursor.c b/client/renderers/EGL/cursor.c index 607d5958..a356766a 100644 --- a/client/renderers/EGL/cursor.c +++ b/client/renderers/EGL/cursor.c @@ -330,7 +330,7 @@ struct CursorState egl_cursorRender(EGL_Cursor * cursor, break; default: - assert(!"unreachable"); + DEBUG_UNREACHABLE(); } state.rect.x = max(0, state.rect.x); diff --git a/client/renderers/EGL/egl.c b/client/renderers/EGL/egl.c index 4ed7b7ba..cfe9443e 100644 --- a/client/renderers/EGL/egl.c +++ b/client/renderers/EGL/egl.c @@ -36,7 +36,6 @@ #include "cimgui.h" #include "generator/output/cimgui_impl.h" -#include #include #include @@ -325,7 +324,7 @@ static void egl_calc_mouse_size(struct Inst * this) break; default: - assert(!"unreachable"); + DEBUG_UNREACHABLE(); } switch((this->format.rotate + this->rotate) % LG_ROTATE_MAX) diff --git a/client/src/core.c b/client/src/core.c index 70053b73..04e39cbd 100644 --- a/client/src/core.c +++ b/client/src/core.c @@ -27,7 +27,6 @@ #include "common/debug.h" #include "common/array.h" -#include #include #define RESIZE_TIMEOUT (10 * 1000) // 10ms @@ -185,7 +184,7 @@ void core_updatePositionInfo(void) break; default: - assert(!"unreachable"); + DEBUG_UNREACHABLE(); } if (g_params.keepAspect) diff --git a/client/src/util.c b/client/src/util.c index 9b106902..8786c76d 100644 --- a/client/src/util.c +++ b/client/src/util.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include @@ -182,7 +181,7 @@ void util_localCurToGuest(struct DoublePoint *guest) break; default: - assert(!"unreachable"); + DEBUG_UNREACHABLE(); } }