mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 16:18:52 +00:00
Remove unused packages
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
package runtime
|
package runtime
|
||||||
|
|
||||||
import "core:os"
|
import "core:os"
|
||||||
import "core:unicode/utf8"
|
|
||||||
import "core:raw"
|
import "core:raw"
|
||||||
import "core:mem"
|
import "core:mem"
|
||||||
|
|
||||||
// Naming Conventions:
|
// Naming Conventions:
|
||||||
// In general, Ada_Case for types and snake_case for values
|
// In general, Ada_Case for types and snake_case for values
|
||||||
//
|
//
|
||||||
|
// Package Name: snake_case (but prefer single word)
|
||||||
// Import Name: snake_case (but prefer single word)
|
// Import Name: snake_case (but prefer single word)
|
||||||
// Types: Ada_Case
|
// Types: Ada_Case
|
||||||
// Enum Values: Ada_Case
|
// Enum Values: Ada_Case
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package strings
|
package strings
|
||||||
|
|
||||||
import "core:mem"
|
|
||||||
import "core:raw"
|
import "core:raw"
|
||||||
|
|
||||||
new_string :: proc(s: string) -> string {
|
new_string :: proc(s: string) -> string {
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package utf16
|
package utf16
|
||||||
|
|
||||||
import "core:unicode/utf8"
|
|
||||||
|
|
||||||
REPLACEMENT_CHAR :: '\uFFFD';
|
REPLACEMENT_CHAR :: '\uFFFD';
|
||||||
MAX_RUNE :: '\U0010FFFF';
|
MAX_RUNE :: '\U0010FFFF';
|
||||||
|
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ general_stuff :: proc() {
|
|||||||
x3: b32 = true;
|
x3: b32 = true;
|
||||||
x4: b64 = false;
|
x4: b64 = false;
|
||||||
|
|
||||||
|
fmt.printf("x0: %T = %v;\n", x0, x0);
|
||||||
fmt.printf("x1: %T = %v;\n", x1, x1);
|
fmt.printf("x1: %T = %v;\n", x1, x1);
|
||||||
fmt.printf("x2: %T = %v;\n", x2, x2);
|
fmt.printf("x2: %T = %v;\n", x2, x2);
|
||||||
fmt.printf("x3: %T = %v;\n", x3, x3);
|
fmt.printf("x3: %T = %v;\n", x3, x3);
|
||||||
|
|||||||
+21
-5
@@ -445,8 +445,14 @@ void check_scope_usage(Checker *c, Scope *scope) {
|
|||||||
|
|
||||||
for_array(i, scope->elements.entries) {
|
for_array(i, scope->elements.entries) {
|
||||||
Entity *e = scope->elements.entries[i].value;
|
Entity *e = scope->elements.entries[i].value;
|
||||||
if (e != nullptr && e->kind == Entity_Variable && (e->flags&EntityFlag_Used) == 0) {
|
if (e != nullptr && (e->flags&EntityFlag_Used) == 0) {
|
||||||
|
switch (e->kind) {
|
||||||
|
case Entity_Variable:
|
||||||
|
case Entity_ImportName:
|
||||||
|
case Entity_LibraryName:
|
||||||
array_add(&unused, e);
|
array_add(&unused, e);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -901,23 +907,25 @@ bool add_entity(Checker *c, Scope *scope, AstNode *identifier, Entity *entity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void add_entity_use(Checker *c, AstNode *identifier, Entity *entity) {
|
void add_entity_use(Checker *c, AstNode *identifier, Entity *entity) {
|
||||||
GB_ASSERT(identifier != nullptr);
|
if (entity == nullptr) {
|
||||||
if (identifier->kind != AstNode_Ident) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (entity == nullptr) {
|
if (identifier != nullptr) {
|
||||||
|
if (identifier->kind != AstNode_Ident) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (entity->identifier == nullptr) {
|
if (entity->identifier == nullptr) {
|
||||||
entity->identifier = identifier;
|
entity->identifier = identifier;
|
||||||
}
|
}
|
||||||
identifier->Ident.entity = entity;
|
identifier->Ident.entity = entity;
|
||||||
add_declaration_dependency(c, entity); // TODO(bill): Should this be here?
|
|
||||||
|
|
||||||
String dmsg = entity->deprecated_message;
|
String dmsg = entity->deprecated_message;
|
||||||
if (dmsg.len > 0) {
|
if (dmsg.len > 0) {
|
||||||
warning(identifier, "%.*s is deprecated: %.*s", LIT(entity->token.string), LIT(dmsg));
|
warning(identifier, "%.*s is deprecated: %.*s", LIT(entity->token.string), LIT(dmsg));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
entity->flags |= EntityFlag_Used;
|
||||||
|
add_declaration_dependency(c, entity); // TODO(bill): Should this be here?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2545,6 +2553,9 @@ void check_add_import_decl(Checker *c, AstNodeImportDecl *id) {
|
|||||||
scope);
|
scope);
|
||||||
|
|
||||||
add_entity(c, parent_scope, nullptr, e);
|
add_entity(c, parent_scope, nullptr, e);
|
||||||
|
if (id->is_using) {
|
||||||
|
add_entity_use(c, nullptr, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2991,6 +3002,11 @@ void check_parsed_files(Checker *c) {
|
|||||||
check_proc_body(c, pi->token, pi->decl, pi->type, pi->body);
|
check_proc_body(c, pi->token, pi->decl, pi->type, pi->body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for_array(i, c->info.files.entries) {
|
||||||
|
AstFile *f = c->info.files.entries[i].value;
|
||||||
|
check_scope_usage(c, f->scope);
|
||||||
|
}
|
||||||
|
|
||||||
TIME_SECTION("generate minimum dependency set");
|
TIME_SECTION("generate minimum dependency set");
|
||||||
generate_minimum_dependency_set(c, c->info.entry_point);
|
generate_minimum_dependency_set(c, c->info.entry_point);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user