Brendan Shanks : include: Force stack alignment on x86_64 with Clang.

Alexandre Julliard julliard at winehq.org
Thu Nov 5 15:37:14 CST 2020


Module: wine
Branch: master
Commit: 91741446c7c8d2e6eb4c87774f20ef8eb9295254
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=91741446c7c8d2e6eb4c87774f20ef8eb9295254

Author: Brendan Shanks <bshanks at codeweavers.com>
Date:   Wed Nov  4 17:29:28 2020 -0800

include: Force stack alignment on x86_64 with Clang.

Signed-off-by: Brendan Shanks <bshanks at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 include/msvcrt/corecrt.h | 8 ++++++--
 include/windef.h         | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/include/msvcrt/corecrt.h b/include/msvcrt/corecrt.h
index ad46c56591c..587dcce2a54 100644
--- a/include/msvcrt/corecrt.h
+++ b/include/msvcrt/corecrt.h
@@ -57,6 +57,10 @@
 #endif
 #endif
 
+#ifndef __has_attribute
+#define __has_attribute(x) 0
+#endif
+
 #if !defined(_MSC_VER) && !defined(__stdcall)
 # ifdef __i386__
 #  ifdef __GNUC__
@@ -69,7 +73,7 @@
 #   error You need to define __stdcall for your compiler
 #  endif
 # elif defined(__x86_64__) && defined (__GNUC__)
-#  if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3))
+#  if __has_attribute(__force_align_arg_pointer__)
 #   define __stdcall __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
 #  else
 #   define __stdcall __attribute__((ms_abi))
@@ -91,7 +95,7 @@
 #   define __cdecl __attribute__((__cdecl__))
 #  endif
 # elif defined(__x86_64__) && defined (__GNUC__)
-#  if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3))
+#  if __has_attribute(__force_align_arg_pointer__)
 #   define __cdecl __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
 #  else
 #   define __cdecl __attribute__((ms_abi))
diff --git a/include/windef.h b/include/windef.h
index 521c3ab4512..db5c60641d4 100644
--- a/include/windef.h
+++ b/include/windef.h
@@ -31,6 +31,10 @@
 # endif /* STRICT */
 #endif /* NO_STRICT */
 
+#ifndef __has_attribute
+#define __has_attribute(x) 0
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -62,7 +66,7 @@ extern "C" {
 #   error You need to define __stdcall for your compiler
 #  endif
 # elif defined(__x86_64__) && defined (__GNUC__)
-#  if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3))
+#  if __has_attribute(__force_align_arg_pointer__)
 #   define __stdcall __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
 #  else
 #   define __stdcall __attribute__((ms_abi))
@@ -84,7 +88,7 @@ extern "C" {
 #   define __cdecl __attribute__((__cdecl__))
 #  endif
 # elif defined(__x86_64__) && defined (__GNUC__)
-#  if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3))
+#  if __has_attribute(__force_align_arg_pointer__)
 #   define __cdecl __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
 #  else
 #   define __cdecl __attribute__((ms_abi))




More information about the wine-cvs mailing list