From 443c328a675a0798640436d9a379ae36d4c1cfc0 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Tue, 2 Apr 2024 14:11:04 -0700 Subject: expr: Help gcc see that variables aren't used uninitialized --- expr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/expr.c b/expr.c index d9fb9b6..5f5990e 100644 --- a/expr.c +++ b/expr.c @@ -540,6 +540,7 @@ stringconcat(struct stringlit *str, bool forceutf8) case 'u': t = &typeushort; break; case 'U': t = &typeuint; break; case 'L': t = targ->typewchar; break; + default: assert(0); } switch (t->size) { case 1: @@ -554,6 +555,8 @@ stringconcat(struct stringlit *str, bool forceutf8) width = sizeof(uint_least32_t); encodechar = encodechar32; break; + default: + assert(0); } buf = xreallocarray(NULL, len, width); str->data = buf; @@ -1238,6 +1241,7 @@ condexpr(struct scope *s) t = mkpointertype(t, tq); } else { error(&tok.loc, "invalid operands to conditional operator"); + return NULL; /* unreachable */ } } e = eval(e); -- cgit v1.2.3