From 46231014e2a7ec1903d4a37e96222481ecc779d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E8=A1=B2=E4=B8=8D=E5=87=BA=E5=AE=B6?= Date: Sun, 29 Sep 2024 11:57:27 +0800 Subject: [PATCH] Fixed the compilation issue on macOS15 M platform (#252) --- src/Util/util.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Util/util.cpp b/src/Util/util.cpp index 05c0d015..1da99cc3 100644 --- a/src/Util/util.cpp +++ b/src/Util/util.cpp @@ -72,6 +72,24 @@ int uv_exepath(char *buffer, int *size) { using namespace std; +#ifndef HAS_CXA_DEMANGLE +// We only support some compilers that support __cxa_demangle. +// TODO: Checks if Android NDK has fixed this issue or not. +#if defined(__ANDROID__) && (defined(__i386__) || defined(__x86_64__)) +#define HAS_CXA_DEMANGLE 0 +#elif (__GNUC__ >= 4 || (__GNUC__ >= 3 && __GNUC_MINOR__ >= 4)) && \ +!defined(__mips__) +#define HAS_CXA_DEMANGLE 1 +#elif defined(__clang__) && !defined(_MSC_VER) +#define HAS_CXA_DEMANGLE 1 +#else +#define HAS_CXA_DEMANGLE 0 +#endif +#endif +#if HAS_CXA_DEMANGLE +#include +#endif + namespace toolkit { static constexpr char CCH[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; @@ -583,24 +601,6 @@ bool setThreadAffinity(int i) { return false; } -#ifndef HAS_CXA_DEMANGLE -// We only support some compilers that support __cxa_demangle. -// TODO: Checks if Android NDK has fixed this issue or not. -#if defined(__ANDROID__) && (defined(__i386__) || defined(__x86_64__)) -#define HAS_CXA_DEMANGLE 0 -#elif (__GNUC__ >= 4 || (__GNUC__ >= 3 && __GNUC_MINOR__ >= 4)) && \ - !defined(__mips__) -#define HAS_CXA_DEMANGLE 1 -#elif defined(__clang__) && !defined(_MSC_VER) -#define HAS_CXA_DEMANGLE 1 -#else -#define HAS_CXA_DEMANGLE 0 -#endif -#endif -#if HAS_CXA_DEMANGLE -#include -#endif - // Demangle a mangled symbol name and return the demangled name. // If 'mangled' isn't mangled in the first place, this function // simply returns 'mangled' as is.