aboutsummaryrefslogtreecommitdiff
path: root/src/check_decl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/check_decl.cpp')
-rw-r--r--src/check_decl.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp
index f0059424e..7978aa0ef 100644
--- a/src/check_decl.cpp
+++ b/src/check_decl.cpp
@@ -578,7 +578,7 @@ gb_internal void check_const_decl(CheckerContext *ctx, Entity *e, Ast *type_expr
if (operand.mode == Addressing_Invalid ||
base_type(operand.type) == t_invalid) {
gbString str = expr_to_string(init);
- error(e->token, "Invalid declaration type '%s'", str);
+ error(init, "Invalid declaration value '%s'", str);
gb_string_free(str);
}
@@ -816,9 +816,14 @@ gb_internal void check_proc_decl(CheckerContext *ctx, Entity *e, DeclInfo *d) {
if (ac.test) {
e->flags |= EntityFlag_Test;
}
- if (ac.init) {
+ if (ac.init && ac.fini) {
+ error(e->token, "A procedure cannot be both declared as @(init) and @(fini)");
+ } else if (ac.init) {
e->flags |= EntityFlag_Init;
+ } else if (ac.fini) {
+ e->flags |= EntityFlag_Fini;
}
+
if (ac.set_cold) {
e->flags |= EntityFlag_Cold;
}