From 69e1f42aedad0d1992e64989aac1d236bee3d4d9 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 1 Aug 2023 11:11:15 +0100 Subject: [PATCH] Replace a lot of warnings with errors; remove deprecated stuff --- src/check_builtin.cpp | 2 +- src/check_decl.cpp | 26 +------------------------- src/check_expr.cpp | 2 +- src/checker.cpp | 6 +++--- src/main.cpp | 7 ------- src/tokenizer.cpp | 4 ++-- 6 files changed, 8 insertions(+), 39 deletions(-) diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp index 269a0ec48..35720c914 100644 --- a/src/check_builtin.cpp +++ b/src/check_builtin.cpp @@ -1406,7 +1406,7 @@ gb_internal bool check_builtin_procedure_directive(CheckerContext *c, Operand *o } return false; } else if (name == "load_or") { - warning(call, "'#load_or' is deprecated in favour of '#load(path) or_else default'"); + error(call, "'#load_or' has now been removed in favour of '#load(path) or_else default'"); if (ce->args.count != 2) { if (ce->args.count == 0) { diff --git a/src/check_decl.cpp b/src/check_decl.cpp index 9e96dae1c..4a1a636f8 100644 --- a/src/check_decl.cpp +++ b/src/check_decl.cpp @@ -354,31 +354,7 @@ gb_internal void check_type_decl(CheckerContext *ctx, Entity *e, Ast *init_expr, // using decl if (decl->is_using) { - warning(init_expr, "'using' an enum declaration is not allowed, prefer using implicit selector expressions e.g. '.A'"); - #if 1 - // NOTE(bill): Must be an enum declaration - if (te->kind == Ast_EnumType) { - Scope *parent = e->scope; - if (parent->flags&ScopeFlag_File) { - // NOTE(bill): Use package scope - parent = parent->parent; - } - - Type *t = base_type(e->type); - if (t->kind == Type_Enum) { - for (Entity *f : t->Enum.fields) { - if (f->kind != Entity_Constant) { - continue; - } - String name = f->token.string; - if (is_blank_ident(name)) { - continue; - } - add_entity(ctx, parent, nullptr, f); - } - } - } - #endif + error(init_expr, "'using' an enum declaration is not allowed, prefer using implicit selector expressions e.g. '.A'"); } } diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 8d159d920..40bf729c1 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -7153,7 +7153,7 @@ gb_internal ExprKind check_call_expr(CheckerContext *c, Operand *operand, Ast *c i32 id = operand->builtin_id; Entity *e = entity_of_node(operand->expr); if (e != nullptr && e->token.string == "expand_to_tuple") { - warning(operand->expr, "'expand_to_tuple' has been replaced with 'expand_values'"); + error(operand->expr, "'expand_to_tuple' has been replaced with 'expand_values'"); } if (!check_builtin_procedure(c, operand, call, id, type_hint)) { operand->mode = Addressing_Invalid; diff --git a/src/checker.cpp b/src/checker.cpp index 895e3c528..91c62c20c 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -3085,7 +3085,7 @@ gb_internal DECL_ATTRIBUTE_PROC(proc_decl_attribute) { check_expr(c, &o, value); Entity *e = entity_of_node(o.expr); if (e != nullptr && e->kind == Entity_Procedure) { - warning(elem, "'%.*s' is deprecated, please use one of the following instead: 'deferred_none', 'deferred_in', 'deferred_out'", LIT(name)); + error(elem, "'%.*s' is not allowed any more, please use one of the following instead: 'deferred_none', 'deferred_in', 'deferred_out'", LIT(name)); if (ac->deferred_procedure.entity != nullptr) { error(elem, "Previous usage of a 'deferred_*' attribute"); } @@ -4584,7 +4584,7 @@ gb_internal DECL_ATTRIBUTE_PROC(foreign_import_decl_attribute) { if (value != nullptr) { error(elem, "Expected no parameter for '%.*s'", LIT(name)); } else if (name == "force") { - warning(elem, "'force' is deprecated and is identical to 'require'"); + error(elem, "'force' was replaced with 'require'"); } ac->require_declaration = true; return true; @@ -6104,7 +6104,7 @@ gb_internal void check_parsed_files(Checker *c) { while (mpsc_dequeue(&c->info.intrinsics_entry_point_usage, &node)) { if (c->info.entry_point == nullptr && node != nullptr) { if (node->file()->pkg->kind != Package_Runtime) { - warning(node, "usage of intrinsics.__entry_point will be a no-op"); + error(node, "usage of intrinsics.__entry_point will be a no-op"); } } } diff --git a/src/main.cpp b/src/main.cpp index 5cecb5682..aa5b2ed34 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2142,16 +2142,9 @@ gb_internal void print_show_help(String const arg0, String const &command) { } if (check) { - #if defined(GB_SYSTEM_WINDOWS) print_usage_line(1, "-no-threaded-checker"); print_usage_line(2, "Disabled multithreading in the semantic checker stage"); print_usage_line(0, ""); - #else - print_usage_line(1, "-threaded-checker"); - print_usage_line(1, "[EXPERIMENTAL]"); - print_usage_line(2, "Multithread the semantic checker stage"); - print_usage_line(0, ""); - #endif } if (check) { diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp index 17a396b9f..ad7aa81de 100644 --- a/src/tokenizer.cpp +++ b/src/tokenizer.cpp @@ -696,8 +696,8 @@ gb_internal void tokenizer_get_token(Tokenizer *t, Token *token, int repeat=0) { if (entry->kind != Token_Invalid && entry->hash == hash) { if (str_eq(entry->text, token->string)) { token->kind = entry->kind; - if (token->kind == Token_not_in && entry->text == "notin") { - syntax_warning(*token, "'notin' is deprecated in favour of 'not_in'"); + if (token->kind == Token_not_in && entry->text.len == 5) { + syntax_error(*token, "Did you mean 'not_in'?"); } } }