diff options
| author | 2025-12-31 18:07:58 +0100 | |
|---|---|---|
| committer | 2025-12-31 18:07:58 +0100 | |
| commit | ec732ef4342b879748d0250245a9b5369bfbb7d3 (patch) | |
| tree | 593c2e071f0f94235ebf6ab765a51134ed27914a | |
| parent | 6969a59985115385974adc4464de972bd10ac9e0 (diff) | |
c: fix diagnostic with "return <undeclared>"
| -rw-r--r-- | c/c.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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) { |