diff options
| author | gingerBill <bill@gingerbill.org> | 2024-06-06 15:16:34 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-06-06 15:16:34 +0100 |
| commit | 9ef43fc782159893b7af139f9d9be3aec3108ecd (patch) | |
| tree | b1da3f8f421d997de2a0c966b3efe87a96f563eb /src/check_stmt.cpp | |
| parent | 971229fe66cdc93135e0f7e41cdf2a0bce28cd67 (diff) | |
Add `@(rodata)`
Diffstat (limited to 'src/check_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index 2c37bced0..fc443a7b5 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -501,6 +501,9 @@ gb_internal Type *check_assignment_variable(CheckerContext *ctx, Operand *lhs, O return nullptr; case Addressing_Variable: + if (e && e->kind == Entity_Variable && e->Variable.is_rodata) { + error(lhs->expr, "Assignment to variable '%.*s' marked as @(rodata) is not allowed", LIT(e->token.string)); + } break; case Addressing_MapIndex: { @@ -2055,6 +2058,9 @@ gb_internal void check_value_decl_stmt(CheckerContext *ctx, Ast *node, u32 mod_f } } } + if (ac.rodata) { + error(e->token, "Only global variables can have @(rodata) applied"); + } if (ac.thread_local_model != "") { String name = e->token.string; if (name == "_") { |