harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 601c16ba9784ba25d8a8ad568a0fcb3d7e9e1a50
parent 9963715530369376cca9be1ec79504ea73dd4feb
Author: Bor Grošelj Simić <bor.groseljsimic@telemach.net>
Date:   Wed, 16 Feb 2022 18:57:26 +0100

check: ensure @noreturn functions return void

Signed-off-by: Bor Grošelj Simić <bor.groseljsimic@telemach.net>

Diffstat:
Msrc/check.c | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/check.c b/src/check.c @@ -3016,6 +3016,10 @@ check_function(struct context *ctx, expect(&adecl->loc, !afndecl->prototype.params, "%s function cannot have parameters", flags); } + if (decl->func.flags & FN_NORETURN) { + expect(&adecl->loc, fntype->func.result == &builtin_type_void, + "@noreturn function must return void"); + }; scope_pop(&ctx->scope); ctx->fntype = NULL;