[libcxx-commits] [libcxxabi] 5449ea9 - [libcxxabi] Define _LIBCXXABI_WEAK properly for mingw compilers
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Oct 21 23:11:58 PDT 2020
Author: Martin Storsjö
Date: 2020-10-22T09:00:57+03:00
New Revision: 5449ea9f90ea8e0adb1f8427b82dd30ccb31d96c
URL: https://github.com/llvm/llvm-project/commit/5449ea9f90ea8e0adb1f8427b82dd30ccb31d96c
DIFF: https://github.com/llvm/llvm-project/commit/5449ea9f90ea8e0adb1f8427b82dd30ccb31d96c.diff
LOG: [libcxxabi] Define _LIBCXXABI_WEAK properly for mingw compilers
Copy over the compiler detection structure from libcxx, and set
_LIBCXXABI_WEAK like _LIBCPP_WEAK is set in libcxx.
This allows users to override operator new/delete, if using those
operators from libcxxabi instead of from libcxx.
Differential Revision: https://reviews.llvm.org/D89863
Added:
Modified:
libcxxabi/include/__cxxabi_config.h
Removed:
################################################################################
diff --git a/libcxxabi/include/__cxxabi_config.h b/libcxxabi/include/__cxxabi_config.h
index 98f55b2a256d..cffedb88df54 100644
--- a/libcxxabi/include/__cxxabi_config.h
+++ b/libcxxabi/include/__cxxabi_config.h
@@ -18,6 +18,19 @@
#define __has_attribute(_attribute_) 0
#endif
+#if defined(__clang__)
+# define _LIBCXXABI_COMPILER_CLANG
+# ifndef __apple_build_version__
+# define _LIBCXXABI_CLANG_VER (__clang_major__ * 100 + __clang_minor__)
+# endif
+#elif defined(__GNUC__)
+# define _LIBCXXABI_COMPILER_GCC
+#elif defined(_MSC_VER)
+# define _LIBCXXABI_COMPILER_MSVC
+#elif defined(__IBMCPP__)
+# define _LIBCXXABI_COMPILER_IBM
+#endif
+
#if defined(_WIN32)
#if defined(_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS)
#define _LIBCXXABI_HIDDEN
@@ -53,7 +66,7 @@
#endif
#endif
-#if defined(_WIN32)
+#if defined(_LIBCXXABI_COMPILER_MSVC)
#define _LIBCXXABI_WEAK
#else
#define _LIBCXXABI_WEAK __attribute__((__weak__))
More information about the libcxx-commits
mailing list