From 8c7297591d88e64749b0ab13c063c6f1b2f882a3 Mon Sep 17 00:00:00 2001
From: "Serge S. Gulin" <gulin.serge@gmail.com>
Date: Thu, 10 Apr 2025 23:46:42 +0300
Subject: [PATCH] Fix call convention warnings for AArch64

---
 Cabal/src/Distribution/Compat/GetShortPathName.hs         | 2 +-
 Cabal/src/Distribution/Compat/Time.hs                     | 2 +-
 Cabal/src/Distribution/Simple/InstallDirs.hs              | 2 +-
 cabal-install/src/Distribution/Client/Win32SelfUpgrade.hs | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Cabal/src/Distribution/Compat/GetShortPathName.hs b/Cabal/src/Distribution/Compat/GetShortPathName.hs
index f6c9517dd7..b6826bb60f 100644
--- a/Cabal/src/Distribution/Compat/GetShortPathName.hs
+++ b/Cabal/src/Distribution/Compat/GetShortPathName.hs
@@ -23,7 +23,7 @@ import System.Win32          (LPCTSTR, LPTSTR, DWORD)
 import Foreign.Marshal.Array (allocaArray)
 
 {- FOURMOLU_DISABLE -}
-#ifdef x86_64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH) || defined(aarch64_HOST_ARCH)
 #define WINAPI ccall
 #else
 #define WINAPI stdcall
diff --git a/Cabal/src/Distribution/Compat/Time.hs b/Cabal/src/Distribution/Compat/Time.hs
index cce1ceaf81..4743e1edb7 100644
--- a/Cabal/src/Distribution/Compat/Time.hs
+++ b/Cabal/src/Distribution/Compat/Time.hs
@@ -94,7 +94,7 @@ getModTime path = allocaBytes size_WIN32_FILE_ATTRIBUTE_DATA $ \info -> do
       return $! ModTime (qwTime :: Word64)
 
 {- FOURMOLU_DISABLE -}
-#ifdef x86_64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH) || defined(aarch64_HOST_ARCH)
 #define CALLCONV ccall
 #else
 #define CALLCONV stdcall
diff --git a/Cabal/src/Distribution/Simple/InstallDirs.hs b/Cabal/src/Distribution/Simple/InstallDirs.hs
index 86e6fa0877..41143ea36e 100644
--- a/Cabal/src/Distribution/Simple/InstallDirs.hs
+++ b/Cabal/src/Distribution/Simple/InstallDirs.hs
@@ -537,7 +537,7 @@ csidl_PROGRAM_FILES = 0x0026
 -- csidl_PROGRAM_FILES_COMMON = 0x002b
 
 {- FOURMOLU_DISABLE -}
-#ifdef x86_64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH) || defined(aarch64_HOST_ARCH)
 #define CALLCONV ccall
 #else
 #define CALLCONV stdcall
diff --git a/cabal-install/src/Distribution/Client/Win32SelfUpgrade.hs b/cabal-install/src/Distribution/Client/Win32SelfUpgrade.hs
index 89b7561026..13a7da5c98 100644
--- a/cabal-install/src/Distribution/Client/Win32SelfUpgrade.hs
+++ b/cabal-install/src/Distribution/Client/Win32SelfUpgrade.hs
@@ -166,7 +166,7 @@ deleteOldExeFile verbosity oldPID tmpPath = do
 -- A bunch of functions sadly not provided by the Win32 package.
 
 {- FOURMOLU_DISABLE -}
-#ifdef x86_64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH) || defined(aarch64_HOST_ARCH)
 #define CALLCONV ccall
 #else
 #define CALLCONV stdcall
-- 
GitLab