From 8dcfa259a2a4596311b9c271043456b49275d0f8 Mon Sep 17 00:00:00 2001 From: Craig Barnes Date: Sat, 17 Sep 2022 06:34:25 +0100 Subject: [PATCH] config: fix "maybe-uninitialized" error when compiling with CFLAGS=-Og MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using GCC 12.2.0 with the following build steps: CFLAGS=-Og meson bld ninja -C bld ...produces the compiler error: ../config.c:2000:18: error: ‘sym_equal’ may be used uninitialized [-Werror=maybe-uninitialized] This commit fixes that by using BUG() to assert that all possible values are accounted for in the offending switch statement. --- config.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config.c b/config.c index 87452cd6..0ba237a0 100644 --- a/config.c +++ b/config.c @@ -2008,6 +2008,9 @@ resolve_key_binding_collisions(struct config *conf, const char *section_name, sym_equal = (binding1->m.button == binding2->m.button && binding1->m.count == binding2->m.count); break; + + default: + BUG("unhandled key binding type"); } if (!mods_equal || !sym_equal)