aboutsummaryrefslogtreecommitdiffhomepage
path: root/c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-12-31 18:07:58 +0100
committerlemon <lsof@mailbox.org>2025-12-31 18:07:58 +0100
commitec732ef4342b879748d0250245a9b5369bfbb7d3 (patch)
tree593c2e071f0f94235ebf6ab765a51134ed27914a /c
parent6969a59985115385974adc4464de972bd10ac9e0 (diff)
c: fix diagnostic with "return <undeclared>"
Diffstat (limited to 'c')
-rw-r--r--c/c.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/c/c.c b/c/c.c
index d3f97ec..f0b4c1e 100644
--- a/c/c.c
+++ b/c/c.c
@@ -155,7 +155,7 @@ isexprtok(struct comp *cm)
struct token tk;
if (peek(cm, &tk) == TKIDENT) {
struct decl *decl = finddecl(cm, tk.name);
- return decl && decl->scls != SCTYPEDEF;
+ return !decl || decl->scls != SCTYPEDEF;
} else {
static const bool tks[] = {
#define tk(x) [x] = 1
@@ -4213,7 +4213,7 @@ stmt(struct comp *cm, struct function *fn)
stmtterm(cm);
break;
case TKWreturn:
- lex(cm, NULL);
+ lex(cm, &tk);
if (isexprtok(cm)) {
ex = commaexpr(cm);
if (fn->retty.t == TYVOID) {