Add @(rodata)

This commit is contained in:
gingerBill
2024-06-06 15:16:34 +01:00
parent 971229fe66
commit 9ef43fc782
6 changed files with 38 additions and 2 deletions
+6
View File
@@ -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 == "_") {