diagnostics: let compiler check error() fmt strings + fixes

This commit is contained in:
kalsprite
2026-08-19 15:39:39 -07:00
parent 6defecf436
commit f17c86d936
8 changed files with 60 additions and 49 deletions

View File

@@ -7380,24 +7380,24 @@ gb_internal void check_objc_context_provider_procedures(Checker *c) {
const char *self_param_err = "The @(objc_context_provider) procedure must take as a parameter a single pointer to the @(objc_type) value.";
if (proc.param_count != 1) {
error(proc_entity->token, self_param_err);
error(proc_entity->token, "%s", self_param_err);
}
Type *self_param = base_type(proc.params->Tuple.variables[0]->type);
if (self_param->kind != Type_Pointer) {
error(proc_entity->token, self_param_err);
error(proc_entity->token, "%s", self_param_err);
}
Type *self_type = base_named_type(self_param->Pointer.elem);
if (!internal_check_is_assignable_to(self_type, e->type) &&
!(e->TypeName.objc_ivar && internal_check_is_assignable_to(self_type, e->TypeName.objc_ivar))) {
error(proc_entity->token, self_param_err);
error(proc_entity->token, "%s", self_param_err);
}
if (proc.calling_convention != ProcCC_CDecl && proc.calling_convention != ProcCC_Contextless) {
error(e->token, self_param_err);
error(e->token, "%s", self_param_err);
}
if (proc.is_polymorphic) {
error(e->token, self_param_err);
error(e->token, "%s", self_param_err);
}
}
}