Move redundant auto_cast error from -vet to -vet-extra

This commit is contained in:
gingerBill
2021-09-28 12:24:51 +01:00
parent ea0bf05727
commit 6f872e04c8
3 changed files with 14 additions and 3 deletions

View File

@@ -429,6 +429,7 @@ bool find_or_generate_polymorphic_procedure(CheckerContext *old_c, Entity *base_
if (poly_proc_data) {
poly_proc_data->gen_entity = entity;
poly_proc_data->proc_info = proc_info;
entity->Procedure.generated_from_polymorphic = proc_info->generated_from_polymorphic;
}
// NOTE(bill): Check the newly generated procedure body
@@ -7965,10 +7966,8 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type
Type *type = type_of_expr(ac->expr);
check_cast(c, o, type_hint);
if (is_type_typed(type) && are_types_identical(type, type_hint)) {
if (build_context.vet) {
if (build_context.vet_extra) {
error(node, "Redundant 'auto_cast' applied to expression");
} else {
// warning(node, "Redundant 'auto_cast' applied to expression");
}
}

View File

@@ -183,6 +183,7 @@ struct Entity {
DeferredProcedure deferred_procedure;
bool is_foreign;
bool is_export;
bool generated_from_polymorphic;
ProcedureOptimizationMode optimization_mode;
} Procedure;
struct {

View File

@@ -1204,6 +1204,17 @@ lbValue lb_emit_conv(lbProcedure *p, lbValue value, Type *t) {
}
return lb_emit_conv(p, res, t);
}
if (is_type_integer_128bit(dst)) {
auto args = array_make<lbValue>(temporary_allocator(), 1);
args[0] = value;
char const *call = "fixunsdfdi";
if (is_type_unsigned(dst)) {
call = "fixunsdfti";
}
lbValue res_i128 = lb_emit_runtime_call(p, call, args);
return lb_emit_conv(p, res_i128, t);
}
lbValue res = {};
res.type = t;