aboutsummaryrefslogtreecommitdiff
path: root/src/check_type.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-02-16 16:03:49 +0000
committergingerBill <bill@gingerbill.org>2022-02-16 16:03:49 +0000
commitdb6bd9b358f17c0259ff5fe6411ce93407613338 (patch)
tree54b7e06a4bee7fcc1813616a5bcb9df11da6d6a5 /src/check_type.cpp
parent42ad54c28ee013618c7ee0039bbe1ce5dd1f0ba6 (diff)
Allow sysv and win64 calling conventions to be used on any platform on amd64
Diffstat (limited to 'src/check_type.cpp')
-rw-r--r--src/check_type.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp
index 32340070e..a11f5234b 100644
--- a/src/check_type.cpp
+++ b/src/check_type.cpp
@@ -1910,6 +1910,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;