From 0d8f9520e92f1c50244035e96143fe9d1b5935ad Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Tue, 9 Sep 2025 01:05:20 +0200 Subject: [PATCH] CVaList support on MacOS aarch64. --- lib/std/core/cinterop.c3 | 11 +++++++++++ releasenotes.md | 1 + 2 files changed, 12 insertions(+) diff --git a/lib/std/core/cinterop.c3 b/lib/std/core/cinterop.c3 index 7888115d0..f20c6990f 100644 --- a/lib/std/core/cinterop.c3 +++ b/lib/std/core/cinterop.c3 @@ -59,3 +59,14 @@ macro typeid unsigned_int_from_bitsize(usz $bitsize) @private $default: $error("Invalid bitsize"); $endswitch } + +module std::core::cinterop @if(env::MACOS && env::AARCH64); + +typedef CVaList = void*; +macro CVaList.next(&self, $Type) +{ + void *ptr = mem::aligned_pointer((void*)*self, max($Type.alignof, 8)); + defer *self = (CVaList)(ptr + 1); + return *($Type*)ptr; +} + diff --git a/releasenotes.md b/releasenotes.md index 16687dfb6..fb39ed3e4 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -26,6 +26,7 @@ `path::public_share_directory`, `path::templates_directory`, `path::saved_games_directory`, `path::music_directory`, `path::downloads_directory`. - Add `LinkedList` array_view to support `[]` and `foreach`/`foreach_r`. #2438 - Make `LinkedList` printable and add `==` operator. #2438 +- CVaList support on MacOS aarch64. ## 0.7.5 Change list