[PATCH] D136605: [libc++] Fixes for static libc++ on Windows using VCRuntime ABI

Andrew Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 24 07:47:08 PDT 2022


andrewng created this revision.
andrewng added reviewers: ldionne, EricWF, pcc, thomasanderson.
Herald added a project: All.
andrewng requested review of this revision.

Avoid duplicate symbol errors for std::nothrow and
std::uncaught_exception with static linking.


https://reviews.llvm.org/D136605

Files:
  libcxx/src/new.cpp
  libcxx/src/support/runtime/exception_msvc.ipp


Index: libcxx/src/support/runtime/exception_msvc.ipp
===================================================================
--- libcxx/src/support/runtime/exception_msvc.ipp
+++ libcxx/src/support/runtime/exception_msvc.ipp
@@ -76,11 +76,13 @@
 #endif // _LIBCPP_NO_EXCEPTIONS
 }
 
+#if !(defined(_LIBCPP_ABI_VCRUNTIME) && defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS))
 bool uncaught_exception() noexcept { return uncaught_exceptions() > 0; }
 
 int uncaught_exceptions() noexcept {
     return __uncaught_exceptions();
 }
+#endif
 
 #if !defined(_LIBCPP_ABI_VCRUNTIME)
 bad_cast::bad_cast() noexcept
Index: libcxx/src/new.cpp
===================================================================
--- libcxx/src/new.cpp
+++ libcxx/src/new.cpp
@@ -29,7 +29,7 @@
 namespace std
 {
 
-#ifndef __GLIBCXX__
+#if !defined(__GLIBCXX__) && !(defined(_LIBCPP_ABI_VCRUNTIME) && defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS))
 const nothrow_t nothrow{};
 #endif
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136605.470150.patch
Type: text/x-patch
Size: 953 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221024/1e5ed077/attachment.bin>


More information about the llvm-commits mailing list