aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2024-04-03 11:39:25 +0100
committerGitHub <noreply@github.com>2024-04-03 11:39:25 +0100
commita1d94423808ad197cc8e16c0add50edd5b6c92f4 (patch)
treee663f9e7b4f728ba6868953cdf68e09dd668fb79 /src
parenta9bfb3ac2e3a0f1e4c98596685e983aaf1e1f651 (diff)
parentb754c1e0726036c0682fb2a7950640f2957ad4f7 (diff)
Merge pull request #3367 from laytan/fix-stack-overflow-warning
fix -vet warning for stack overflows not showing up
Diffstat (limited to 'src')
-rw-r--r--src/checker.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/checker.cpp b/src/checker.cpp
index 100b53315..82f0a09be 100644
--- a/src/checker.cpp
+++ b/src/checker.cpp
@@ -703,6 +703,15 @@ gb_internal void check_scope_usage(Checker *c, Scope *scope, u64 vet_flags) {
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)) == 0) {
+ i64 sz = type_size_of(e->type);
+ // TODO(bill): When is a good size warn?
+ // Is 128 KiB good enough?
+ if (sz >= 1ll<<17) {
+ gbString type_str = type_to_string(e->type);
+ warning(e->token, "Declaration of '%.*s' may cause a stack overflow due to its type '%s' having a size of %lld bytes", LIT(e->token.string), type_str, cast(long long)sz);
+ gb_string_free(type_str);
+ }
}
}
rw_mutex_shared_unlock(&scope->mutex);
@@ -734,17 +743,6 @@ gb_internal void check_scope_usage(Checker *c, Scope *scope, u64 vet_flags) {
break;
}
}
-
- if (e->kind == Entity_Variable && (e->flags & (EntityFlag_Param|EntityFlag_Using)) == 0) {
- i64 sz = type_size_of(e->type);
- // TODO(bill): When is a good size warn?
- // Is 128 KiB good enough?
- if (sz >= 1ll<<17) {
- gbString type_str = type_to_string(e->type);
- warning(e->token, "Declaration of '%.*s' may cause a stack overflow due to its type '%s' having a size of %lld bytes", LIT(name), type_str, cast(long long)sz);
- gb_string_free(type_str);
- }
- }
}
array_free(&vetted_entities);