diff options
| author | gingerBill <bill@gingerbill.org> | 2022-02-16 16:04:20 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-02-16 16:04:20 +0000 |
| commit | 8e8a075a2232038eb3a24e2b7b0a0b183d13b89d (patch) | |
| tree | 281af208f9cdc367ba793991c3242db94a1eb851 /src/check_type.cpp | |
| parent | 65dedbb1caaa785a444d32a7a15adaf6c396b07f (diff) | |
| parent | db6bd9b358f17c0259ff5fe6411ce93407613338 (diff) | |
Merge branch 'master' into directx-packages
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index 7e0ad2bd9..6c49b9b8b 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -1928,6 +1928,25 @@ bool check_procedure_type(CheckerContext *ctx, Type *type, Ast *proc_type_node, c->scope->flags &= ~ScopeFlag_ContextDefined; } + TargetArchKind arch = build_context.metrics.arch; + switch (cc) { + case ProcCC_StdCall: + case ProcCC_FastCall: + if (arch != TargetArch_i386 || arch != TargetArch_amd64) { + error(proc_type_node, "Invalid procedure calling convention \"%s\" for target architecture, expected either i386 or amd64, got %.*s", + proc_calling_convention_strings[cc], LIT(target_arch_names[arch])); + } + break; + case ProcCC_Win64: + case ProcCC_SysV: + if (arch != TargetArch_amd64) { + error(proc_type_node, "Invalid procedure calling convention \"%s\" for target architecture, expected amd64, got %.*s", + proc_calling_convention_strings[cc], LIT(target_arch_names[arch])); + } + break; + } + + bool variadic = false; isize variadic_index = -1; bool success = true; |