mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 16:18:52 +00:00
Remove -vet-extra
This commit is contained in:
@@ -237,9 +237,7 @@ enum VetFlags : u64 {
|
|||||||
VetFlag_Style = 1u<<4, // 16
|
VetFlag_Style = 1u<<4, // 16
|
||||||
VetFlag_Semicolon = 1u<<5, // 32
|
VetFlag_Semicolon = 1u<<5, // 32
|
||||||
|
|
||||||
VetFlag_Extra = 1u<<16,
|
VetFlag_All = VetFlag_Unused|VetFlag_Shadowing|VetFlag_UsingStmt,
|
||||||
|
|
||||||
VetFlag_All = VetFlag_Unused|VetFlag_Shadowing|VetFlag_UsingStmt, // excluding extra
|
|
||||||
|
|
||||||
VetFlag_Using = VetFlag_UsingStmt|VetFlag_UsingParam,
|
VetFlag_Using = VetFlag_UsingStmt|VetFlag_UsingParam,
|
||||||
};
|
};
|
||||||
@@ -257,8 +255,6 @@ u64 get_vet_flag_from_name(String const &name) {
|
|||||||
return VetFlag_Style;
|
return VetFlag_Style;
|
||||||
} else if (name == "semicolon") {
|
} else if (name == "semicolon") {
|
||||||
return VetFlag_Semicolon;
|
return VetFlag_Semicolon;
|
||||||
} else if (name == "extra") {
|
|
||||||
return VetFlag_Extra;
|
|
||||||
}
|
}
|
||||||
return VetFlag_NONE;
|
return VetFlag_NONE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3102,14 +3102,6 @@ gb_internal void check_cast(CheckerContext *c, Operand *x, Type *type) {
|
|||||||
update_untyped_expr_type(c, x->expr, final_type, true);
|
update_untyped_expr_type(c, x->expr, final_type, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_vet_flags(x->expr) & VetFlag_Extra) {
|
|
||||||
if (are_types_identical(x->type, type)) {
|
|
||||||
gbString str = type_to_string(type);
|
|
||||||
warning(x->expr, "Unneeded cast to the same type '%s'", str);
|
|
||||||
gb_string_free(str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
x->type = type;
|
x->type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3174,14 +3166,6 @@ gb_internal bool check_transmute(CheckerContext *c, Ast *node, Operand *o, Type
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_vet_flags(node) & VetFlag_Extra) {
|
|
||||||
if (are_types_identical(o->type, dst_t)) {
|
|
||||||
gbString str = type_to_string(dst_t);
|
|
||||||
warning(o->expr, "Unneeded transmute to the same type '%s'", str);
|
|
||||||
gb_string_free(str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
o->expr = node;
|
o->expr = node;
|
||||||
o->type = dst_t;
|
o->type = dst_t;
|
||||||
if (o->mode == Addressing_Constant) {
|
if (o->mode == Addressing_Constant) {
|
||||||
@@ -10124,14 +10108,7 @@ gb_internal ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast
|
|||||||
return kind;
|
return kind;
|
||||||
}
|
}
|
||||||
if (type_hint) {
|
if (type_hint) {
|
||||||
Type *type = type_of_expr(ac->expr);
|
|
||||||
check_cast(c, o, type_hint);
|
check_cast(c, o, type_hint);
|
||||||
if (is_type_typed(type) && are_types_identical(type, type_hint)) {
|
|
||||||
if (check_vet_flags(node) & VetFlag_Extra) {
|
|
||||||
error(node, "Redundant 'auto_cast' applied to expression");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
o->expr = node;
|
o->expr = node;
|
||||||
return Expr_Expr;
|
return Expr_Expr;
|
||||||
|
|||||||
@@ -257,7 +257,6 @@ enum BuildFlagKind {
|
|||||||
BuildFlag_VetUsingParam,
|
BuildFlag_VetUsingParam,
|
||||||
BuildFlag_VetStyle,
|
BuildFlag_VetStyle,
|
||||||
BuildFlag_VetSemicolon,
|
BuildFlag_VetSemicolon,
|
||||||
BuildFlag_VetExtra,
|
|
||||||
|
|
||||||
BuildFlag_IgnoreUnknownAttributes,
|
BuildFlag_IgnoreUnknownAttributes,
|
||||||
BuildFlag_ExtraLinkerFlags,
|
BuildFlag_ExtraLinkerFlags,
|
||||||
@@ -445,7 +444,6 @@ gb_internal bool parse_build_flags(Array<String> args) {
|
|||||||
add_flag(&build_flags, BuildFlag_VetUsingParam, str_lit("vet-using-param"), BuildFlagParam_None, Command__does_check);
|
add_flag(&build_flags, BuildFlag_VetUsingParam, str_lit("vet-using-param"), BuildFlagParam_None, Command__does_check);
|
||||||
add_flag(&build_flags, BuildFlag_VetStyle, str_lit("vet-style"), BuildFlagParam_None, Command__does_check);
|
add_flag(&build_flags, BuildFlag_VetStyle, str_lit("vet-style"), BuildFlagParam_None, Command__does_check);
|
||||||
add_flag(&build_flags, BuildFlag_VetSemicolon, str_lit("vet-semicolon"), BuildFlagParam_None, Command__does_check);
|
add_flag(&build_flags, BuildFlag_VetSemicolon, str_lit("vet-semicolon"), BuildFlagParam_None, Command__does_check);
|
||||||
add_flag(&build_flags, BuildFlag_VetExtra, str_lit("vet-extra"), BuildFlagParam_None, Command__does_check);
|
|
||||||
|
|
||||||
add_flag(&build_flags, BuildFlag_IgnoreUnknownAttributes, str_lit("ignore-unknown-attributes"), BuildFlagParam_None, Command__does_check);
|
add_flag(&build_flags, BuildFlag_IgnoreUnknownAttributes, str_lit("ignore-unknown-attributes"), BuildFlagParam_None, Command__does_check);
|
||||||
add_flag(&build_flags, BuildFlag_ExtraLinkerFlags, str_lit("extra-linker-flags"), BuildFlagParam_String, Command__does_build);
|
add_flag(&build_flags, BuildFlag_ExtraLinkerFlags, str_lit("extra-linker-flags"), BuildFlagParam_String, Command__does_build);
|
||||||
@@ -1024,12 +1022,7 @@ gb_internal bool parse_build_flags(Array<String> args) {
|
|||||||
build_context.show_debug_messages = true;
|
build_context.show_debug_messages = true;
|
||||||
break;
|
break;
|
||||||
case BuildFlag_Vet:
|
case BuildFlag_Vet:
|
||||||
if (build_context.vet_flags & VetFlag_Extra) {
|
|
||||||
build_context.vet_flags |= VetFlag_All;
|
build_context.vet_flags |= VetFlag_All;
|
||||||
} else {
|
|
||||||
build_context.vet_flags &= ~VetFlag_Extra;
|
|
||||||
build_context.vet_flags |= VetFlag_All;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BuildFlag_VetUnused: build_context.vet_flags |= VetFlag_Unused; break;
|
case BuildFlag_VetUnused: build_context.vet_flags |= VetFlag_Unused; break;
|
||||||
@@ -1039,10 +1032,6 @@ gb_internal bool parse_build_flags(Array<String> args) {
|
|||||||
case BuildFlag_VetStyle: build_context.vet_flags |= VetFlag_Style; break;
|
case BuildFlag_VetStyle: build_context.vet_flags |= VetFlag_Style; break;
|
||||||
case BuildFlag_VetSemicolon: build_context.vet_flags |= VetFlag_Semicolon; break;
|
case BuildFlag_VetSemicolon: build_context.vet_flags |= VetFlag_Semicolon; break;
|
||||||
|
|
||||||
case BuildFlag_VetExtra:
|
|
||||||
build_context.vet_flags = VetFlag_All | VetFlag_Extra;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BuildFlag_IgnoreUnknownAttributes:
|
case BuildFlag_IgnoreUnknownAttributes:
|
||||||
build_context.ignore_unknown_attributes = true;
|
build_context.ignore_unknown_attributes = true;
|
||||||
break;
|
break;
|
||||||
@@ -1846,11 +1835,6 @@ gb_internal void print_show_help(String const arg0, String const &command) {
|
|||||||
print_usage_line(1, "-vet-semicolon");
|
print_usage_line(1, "-vet-semicolon");
|
||||||
print_usage_line(2, "Errs on unneeded semicolons");
|
print_usage_line(2, "Errs on unneeded semicolons");
|
||||||
print_usage_line(0, "");
|
print_usage_line(0, "");
|
||||||
|
|
||||||
print_usage_line(1, "-vet-extra");
|
|
||||||
print_usage_line(2, "Do even more checks than standard vet on the code");
|
|
||||||
print_usage_line(2, "To treat the extra warnings as errors, use -warnings-as-errors");
|
|
||||||
print_usage_line(0, "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check) {
|
if (check) {
|
||||||
|
|||||||
Reference in New Issue
Block a user