aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2024-04-02 14:11:04 -0700
committerMichael Forney <mforney@mforney.org>2024-04-03 00:01:03 -0700
commit443c328a675a0798640436d9a379ae36d4c1cfc0 (patch)
tree83ac7130d1a9cd2acea1c663726c3d92b5431df1
parentbe3fc1c2dc8352fdb1a0ee9385a3bcc06875b55c (diff)
expr: Help gcc see that variables aren't used uninitialized
-rw-r--r--expr.c4
1 files changed, 4 insertions, 0 deletions
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);