diff options
| author | gingerBill <bill@gingerbill.org> | 2025-01-28 10:31:46 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2025-01-28 10:31:46 +0000 |
| commit | 868ab277209908a3857c874014bced9e0fae6949 (patch) | |
| tree | 74508056e39c194490b293fab923afd1c6ab586f /src/checker.cpp | |
| parent | e7cf6c3275a4d49ac9439d4ef605802a73be7513 (diff) | |
Add `@(ignore_duplicates)` for `foreign import` declarations
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index 85077a5c5..baa1e0d2b 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -5040,6 +5040,12 @@ gb_internal DECL_ATTRIBUTE_PROC(foreign_import_decl_attribute) { ac->extra_linker_flags = ev.value_string; } return true; + } else if (name == "ignore_duplicates") { + if (value != nullptr) { + error(elem, "Expected no parameter for '%.*s'", LIT(name)); + } + ac->ignore_duplicates = true; + return true; } return false; } @@ -5190,6 +5196,9 @@ gb_internal void check_add_foreign_import_decl(CheckerContext *ctx, Ast *decl) { if (ac.foreign_import_priority_index != 0) { e->LibraryName.priority_index = ac.foreign_import_priority_index; } + if (ac.ignore_duplicates) { + e->LibraryName.ignore_duplicates = true; + } String extra_linker_flags = string_trim_whitespace(ac.extra_linker_flags); if (extra_linker_flags.len != 0) { e->LibraryName.extra_linker_flags = extra_linker_flags; |