From 2938ec028f710edc2227169b15023d9b30c3aa11 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Thu, 15 Jul 2021 00:37:59 +0100 Subject: [PATCH] Remove dead code --- src/check_decl.cpp | 4 ---- src/checker.cpp | 16 +--------------- src/checker.hpp | 5 ++++- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/src/check_decl.cpp b/src/check_decl.cpp index 29640ad3a..fb3ef8038 100644 --- a/src/check_decl.cpp +++ b/src/check_decl.cpp @@ -1343,7 +1343,3 @@ void check_proc_body(CheckerContext *ctx_, Token token, DeclInfo *decl, Type *ty } } } - - - - diff --git a/src/checker.cpp b/src/checker.cpp index 0332d04b8..e251c2b61 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -4089,20 +4089,7 @@ void check_import_entities(Checker *c) { auto path = find_import_path(c, pkg, pkg, &visited); defer (array_free(&path)); - // TODO(bill): This needs better TokenPos finding - auto const fn = [](ImportPathItem item) -> String { - return item.pkg->name; - }; - - #if 1 - if (path.count == 1) { - // TODO(bill): Should this be allowed or disabled? - #if 0 - ImportPathItem item = path[0]; - String filename = fn(item); - error(item.decl, "Self importation of '%.*s'", LIT(filename)); - #endif - } else if (path.count > 0) { + if (path.count > 1) { ImportPathItem item = path[path.count-1]; String pkg_name = item.pkg->name; error(item.decl, "Cyclic importation of '%.*s'", LIT(pkg_name)); @@ -4113,7 +4100,6 @@ void check_import_entities(Checker *c) { } error(item.decl, "'%.*s'", LIT(pkg_name)); } - #endif } for_array(i, n->pred.entries) { diff --git a/src/checker.hpp b/src/checker.hpp index f11df39e6..6e111c5e4 100644 --- a/src/checker.hpp +++ b/src/checker.hpp @@ -295,7 +295,10 @@ struct CheckerInfo { // NOTE(bill): If the semantic checker (check_proc_body) is to ever to be multithreaded, // these variables will be of contention - BlockingMutex deps_mutex; // NOT recursive & Only used in `check_proc_body` + // NOT recursive & Only used at the end of `check_proc_body` + // This is a possible source of contention but probably not + // too much of a problem in practice + BlockingMutex deps_mutex; gbMutex gen_procs_mutex; // Possibly recursive gbMutex gen_types_mutex; // Possibly recursive