diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 24ee86810..cd38ff69a 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -10179,6 +10179,10 @@ gb_internal ExprKind check_or_branch_expr(CheckerContext *c, Operand *o, Ast *no } } + if (c->in_defer) { + error(node, "'%.*s' cannot be used within a 'defer'", LIT(name)); + } + return Expr_Expr; } diff --git a/src/checker.cpp b/src/checker.cpp index 2f66d3e60..0624c65ac 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -791,7 +791,10 @@ gb_internal void check_scope_usage_internal(Checker *c, Scope *scope, u64 vet_fl array_add(&vetted_entities, ve_unused); } else if (is_shadowed) { array_add(&vetted_entities, ve_shadowed); - } else if (e->kind == Entity_Variable && (e->flags & (EntityFlag_Param|EntityFlag_Using|EntityFlag_Static|EntityFlag_Field)) == 0 && !e->Variable.is_global) { + } else if (e->kind == Entity_Variable && + ((e->flags & (EntityFlag_Param|EntityFlag_Using|EntityFlag_Static|EntityFlag_Field)) == 0 || + (e->flags & EntityFlag_Result) != 0) && + !e->Variable.is_global) { i64 sz = type_size_of(e->type); // TODO(bill): When is a good size warn? // Is >256 KiB good enough? diff --git a/src/main.cpp b/src/main.cpp index 3a72c2a9c..51dade656 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3842,6 +3842,10 @@ int main(int arg_count, char const **arg_ptr) { usage(args[0]); return 1; } + // NOTE(Jeroen): `odin root` omits a newline on purpose so that it can be used in scripts. + // e.g. `ODIN_CORE="$(odin root)core"`. + // Human convenience is not a consideration. + // Further pull requests to add a newline will be closed without comment. gb_printf("%.*s", LIT(odin_root_dir())); return 0; } else if (command == "clear-cache") {