aboutsummaryrefslogtreecommitdiff
path: root/src/check_type.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-04-19 23:03:22 +0100
committergingerBill <bill@gingerbill.org>2021-04-19 23:03:22 +0100
commitba9f0dd55303fbde7fa160d1c1c3d4ddf38182e4 (patch)
tree6395772c86cda8772c1648a84a1b9f4022c4b267 /src/check_type.cpp
parentc3b3194a00150ee0f5a9cd7b86d2b93ff72566a1 (diff)
Hack ABI for windows passing pointers to structures
Diffstat (limited to 'src/check_type.cpp')
-rw-r--r--src/check_type.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp
index 35b0c7644..612a11593 100644
--- a/src/check_type.cpp
+++ b/src/check_type.cpp
@@ -2101,8 +2101,15 @@ Type *type_to_abi_compat_param_type(gbAllocator a, Type *original_type, ProcCall
}
break;
}
- case Type_Pointer: break;
- case Type_Proc: break; // NOTE(bill): Just a pointer
+ case Type_Pointer:
+ if (is_type_struct(bt->Pointer.elem)) {
+ // Force to a raw pointer
+ new_type = t_rawptr;
+ }
+ break;
+ case Type_Proc:
+ new_type = t_rawptr;
+ break; // NOTE(bill): Just a pointer
// Odin specific
case Type_Slice:
@@ -2194,6 +2201,10 @@ Type *type_to_abi_compat_result_type(gbAllocator a, Type *original_type, ProcCal
return new_type;
}
+ if (is_type_pointer(single_type)) {
+ // NOTE(bill): Force a cast to prevent a possible type cycle
+ return t_rawptr;
+ }
if (build_context.ODIN_OS == "windows") {
if (build_context.ODIN_ARCH == "amd64") {