diff options
| author | gingerBill <bill@gingerbill.org> | 2017-10-29 18:09:05 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2017-10-29 18:09:05 +0000 |
| commit | 3e05be8eb8b14729b63ee541d11b3deb19b38710 (patch) | |
| tree | 938e806dc49e06fbed11bd1a1fe718b481a935f6 /src/check_decl.cpp | |
| parent | ae24a8e5ae77111cae24cd8d710b63636b737283 (diff) | |
`@(default_calling_convention = ...)` for `foreign` blocks
Diffstat (limited to 'src/check_decl.cpp')
| -rw-r--r-- | src/check_decl.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp index 1361ac31c..bc8d35a40 100644 --- a/src/check_decl.cpp +++ b/src/check_decl.cpp @@ -467,6 +467,10 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) { if (d != nullptr && d->attributes.count > 0) { + StringSet set = {}; + string_set_init(&set, heap_allocator()); + defer (string_set_destroy(&set)); + for_array(i, d->attributes) { AstNode *attr = d->attributes[i]; if (attr->kind != AstNode_Attribute) continue; @@ -500,14 +504,17 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) { } } + if (string_set_exists(&set, name)) { + error(elem, "Previous declaration of `%.*s`", LIT(name)); + } else { + string_set_add(&set, name); + } + if (name == "link_name") { - if (link_name.len > 0) { - error(elem, "Previous declaration of `link_name`"); - } if (ev.kind == ExactValue_String) { link_name = ev.value_string; } else { - error(elem, "Expected a string value for `link_name`"); + error(elem, "Expected a string value for `%.*s`", LIT(name)); } } else { error(elem, "Unknown attribute element name `%.*s`", LIT(name)); |