c_va_start: test the operand it just checked; c_va_arg: drop the unfed verb

This commit is contained in:
kalsprite
2026-08-17 18:34:09 -07:00
parent 35779c6fa7
commit c34ae95e8a

View File

@@ -769,12 +769,12 @@ gb_internal bool check_builtin_c_procedure(CheckerContext *c, Operand *operand,
Operand args = {};
check_expr(c, &args, ce->args[1]);
c->allow_c_vararg_param = false;
if (list.mode == Addressing_Invalid) {
if (args.mode == Addressing_Invalid) {
return false;
}
Entity *e = entity_of_node(args.expr);
if (e == nullptr || (e->flags & EntityFlag_CVarArg) == 0) {
error(list.expr, "'%.*s' expected a `#c_vararg` parameter", LIT(builtin_name));
error(args.expr, "'%.*s' expected a `#c_vararg` parameter", LIT(builtin_name));
}
operand->mode = Addressing_NoValue;
@@ -857,7 +857,7 @@ gb_internal bool check_builtin_c_procedure(CheckerContext *c, Operand *operand,
Type *type = check_type(c, ce->args[1]);
if (type == nullptr || type == t_invalid) {
error(ce->args[1], "'%.*s' expected a type as the second parameter to intrinsics.%.*s", LIT(builtin_name));
error(ce->args[1], "'%.*s' expected a type as the second parameter", LIT(builtin_name));
return false;
}