diff options
| author | Colin Davidson <colrdavidson@gmail.com> | 2025-07-07 14:34:05 -0700 |
|---|---|---|
| committer | Colin Davidson <colrdavidson@gmail.com> | 2025-07-07 14:34:05 -0700 |
| commit | 389439ccb9e60014fa9d7dd26220da8b7b68f763 (patch) | |
| tree | 5f2afed73a1baa177a3edd4de23aaedaa7efaff5 /src/check_decl.cpp | |
| parent | 04481e0fd289f854e35a84da909184140940bbf7 (diff) | |
| parent | 86d576f7cc1ceeb7472c18e08e3c74214f26ddc6 (diff) | |
Merge branch 'master' into macharena
Diffstat (limited to 'src/check_decl.cpp')
| -rw-r--r-- | src/check_decl.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp index d53c3c6b7..3d0d95556 100644 --- a/src/check_decl.cpp +++ b/src/check_decl.cpp @@ -1334,12 +1334,16 @@ gb_internal void check_proc_decl(CheckerContext *ctx, Entity *e, DeclInfo *d) { has_instrumentation = false; e->flags |= EntityFlag_Require; } else if (ac.instrumentation_enter) { + init_core_source_code_location(ctx->checker); if (!is_valid_instrumentation_call(e->type)) { init_core_source_code_location(ctx->checker); gbString s = type_to_string(e->type); error(e->token, "@(instrumentation_enter) procedures must have the type '%s', got %s", instrumentation_proc_type_str, s); gb_string_free(s); } + if ((e->scope->flags & (ScopeFlag_File|ScopeFlag_Pkg)) == 0) { + error(e->token, "@(instrumentation_enter) procedures must be declared at the file scope"); + } MUTEX_GUARD(&ctx->info->instrumentation_mutex); if (ctx->info->instrumentation_enter_entity != nullptr) { error(e->token, "@(instrumentation_enter) has already been set"); @@ -1356,6 +1360,9 @@ gb_internal void check_proc_decl(CheckerContext *ctx, Entity *e, DeclInfo *d) { error(e->token, "@(instrumentation_exit) procedures must have the type '%s', got %s", instrumentation_proc_type_str, s); gb_string_free(s); } + if ((e->scope->flags & (ScopeFlag_File|ScopeFlag_Pkg)) == 0) { + error(e->token, "@(instrumentation_exit) procedures must be declared at the file scope"); + } MUTEX_GUARD(&ctx->info->instrumentation_mutex); if (ctx->info->instrumentation_exit_entity != nullptr) { error(e->token, "@(instrumentation_exit) has already been set"); @@ -1370,6 +1377,7 @@ gb_internal void check_proc_decl(CheckerContext *ctx, Entity *e, DeclInfo *d) { e->Procedure.has_instrumentation = has_instrumentation; e->Procedure.no_sanitize_address = ac.no_sanitize_address; + e->Procedure.no_sanitize_memory = ac.no_sanitize_memory; e->deprecated_message = ac.deprecated_message; e->warning_message = ac.warning_message; |