harec

[hare] Hare compiler, written in C11 for POSIX OSs
Log | Files | Refs | README | LICENSE

commit f631856549f9d269ccb9b774bb6718292ff83109
parent a43e3c76072c0d4334117a72d87ae3dfe60c54e6
Author: Sebastian <sebastian@sebsite.pw>
Date:   Sun, 22 May 2022 19:06:04 -0400

check: disallow @noreturn with @init/@fini/@test

Signed-off-by: Sebastian <sebastian@sebsite.pw>

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

diff --git a/src/check.c b/src/check.c @@ -3027,6 +3027,8 @@ check_function(struct context *ctx, }; expect(&adecl->loc, fntype->func.result == &builtin_type_void, "%s function must return void", flag); + expect(&adecl->loc, (fntype->func.flags & FN_NORETURN) == 0, + "%s function must return", flag); expect(&adecl->loc, !decl->exported, "%s function cannot be exported", flag); expect(&adecl->loc, !afndecl->prototype.params,