aboutsummaryrefslogtreecommitdiff
path: root/expr.c
diff options
context:
space:
mode:
Diffstat (limited to 'expr.c')
-rw-r--r--expr.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/expr.c b/expr.c
index 98b23a9..67976b8 100644
--- a/expr.c
+++ b/expr.c
@@ -698,6 +698,7 @@ primaryexpr(struct scope *s)
break;
default:
error(&tok.loc, "expected primary expression");
+ return NULL; /* unreachable */
}
return e;
@@ -848,6 +849,7 @@ builtinfunc(struct scope *s, enum builtinkind kind)
break;
default:
fatal("internal error; unknown builtin");
+ return NULL; /* unreachable */
}
return e;
}
@@ -1055,6 +1057,7 @@ unaryexpr(struct scope *s)
e = unaryexpr(s);
} else {
error(&tok.loc, "expected ')' after '_Alignof'");
+ return NULL; /* unreachable */
}
if (!t) {
if (e->decayed)
@@ -1200,12 +1203,14 @@ condexpr(struct scope *s)
tq = lt->qual | rt->qual;
lt = lt->base;
rt = rt->base;
- if (lt == &typevoid || rt == &typevoid)
+ if (lt == &typevoid || rt == &typevoid) {
t = &typevoid;
- else if (typecompatible(lt, rt))
+ } else if (typecompatible(lt, rt)) {
t = typecomposite(lt, rt);
- else
+ } else {
error(&tok.loc, "operands of conditional operator must have compatible types");
+ return NULL; /* unreachable */
+ }
t = mkpointertype(t, tq);
} else {
error(&tok.loc, "invalid operands to conditional operator");