From bf222557fbe72e4b9ae8c655607d34c4e351c7fe Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Thu, 29 Dec 2022 21:13:58 +0100 Subject: [PATCH] Handle missing tests. --- src/compiler/sema_expr.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/compiler/sema_expr.c b/src/compiler/sema_expr.c index 4a518effd..be1e844a2 100644 --- a/src/compiler/sema_expr.c +++ b/src/compiler/sema_expr.c @@ -5995,11 +5995,29 @@ static inline bool sema_expr_analyse_compiler_const(SemaContext *context, Expr * return true; } case BUILTIN_DEF_TEST_NAMES: + if (!active_target.testing) + { + expr->const_expr.const_kind = CONST_INITIALIZER; + expr->expr_kind = EXPR_CONST; + ConstInitializer *init = expr->const_expr.initializer = CALLOCS(ConstInitializer); + init->kind = CONST_INIT_ZERO; + init->type = expr->type = type_get_subarray(type_chars); + return true; + } expr->type = type_get_subarray(type_chars); expr->test_hook_expr = BUILTIN_DEF_TEST_NAMES; expr->expr_kind = EXPR_TEST_HOOK; return true; case BUILTIN_DEF_TEST_FNS: + if (!active_target.testing) + { + expr->const_expr.const_kind = CONST_INITIALIZER; + expr->expr_kind = EXPR_CONST; + ConstInitializer *init = expr->const_expr.initializer = CALLOCS(ConstInitializer); + init->kind = CONST_INIT_ZERO; + init->type = expr->type = type_get_subarray(type_voidptr); + return true; + } expr->type = type_get_subarray(type_voidptr); expr->test_hook_expr = BUILTIN_DEF_TEST_FNS; expr->expr_kind = EXPR_TEST_HOOK;