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.