From bb8fd08b5bddc5b6570975888e0f0667a6b80ca8 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Mon, 18 Feb 2019 21:08:21 +0000 Subject: [PATCH] Fix a compiler complaint Signed-off-by: Yuxuan Shui --- src/render.c | 10 ++++++---- src/utils.h | 8 ++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/render.c b/src/render.c index db8292d..f199c12 100644 --- a/src/render.c +++ b/src/render.c @@ -1153,17 +1153,19 @@ bool init_render(session_t *ps) { // Blur filter if (ps->o.blur_background || ps->o.blur_background_frame) { - bool ret; + bool ret = false; if (ps->o.backend == BKEND_GLX) { #ifdef CONFIG_OPENGL ret = glx_init_blur(ps); #else assert(false); #endif - } else + } else { ret = xr_init_blur(ps); - if (!ret) - return false; + } + if (!ret) { + return ret; + } } ps->gaussian_map = gaussian_kernel(ps->o.shadow_radius); diff --git a/src/utils.h b/src/utils.h index ce5a8f7..d5e3edc 100644 --- a/src/utils.h +++ b/src/utils.h @@ -9,6 +9,7 @@ #include #include #include +#include #include "compiler.h" @@ -29,6 +30,13 @@ safe_isnan(double a) { return isnan(a); } +/// Same as assert false, but make sure we abort _even in release builds_. +/// Silence compiler warning caused by release builds making some code paths reachable. +attr_noret static inline void BUG(void) { + assert(false); + abort(); +} + /** * Normalize an int value to a specific range. *