harec

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

commit 75925ae34f07c254ade8b59092112381045d5958
parent cd149c7317d554f17687c89bab6d3e5e50e6e935
Author: Bor Grošelj Simić <bgs@turminal.net>
Date:   Fri,  8 Apr 2022 02:49:10 +0200

report errors in global and const initializers

Signed-off-by: Bor Grošelj Simić <bgs@turminal.net>

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

diff --git a/src/check.c b/src/check.c @@ -3242,6 +3242,7 @@ scan_const(struct context *ctx, const struct ast_global_decl *decl) // TODO: Free the initializer struct expression *initializer = xcalloc(1, sizeof(struct expression)); check_expression(ctx, decl->init, initializer, type); + handle_errors(ctx->errors); bool context = decl->type && decl->type->storage == STORAGE_ARRAY @@ -3308,6 +3309,7 @@ scan_global(struct context *ctx, const struct ast_global_decl *decl) struct expression *initializer = xcalloc(1, sizeof(struct expression)); check_expression(ctx, decl->init, initializer, type); + handle_errors(ctx->errors); expect(&decl->init->loc, initializer->result->storage == STORAGE_ARRAY, "Cannot infer array length from non-array type");