[libcxx-commits] [PATCH] D132667: [libc++] Inlines format_error for clang-cl DLL.
Mark de Wever via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Aug 31 10:13:38 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG308a5b1a32f0: [libc++] Inlines format_error for clang-cl DLL. (authored by Mordante).
Changed prior to commit:
https://reviews.llvm.org/D132667?vs=455601&id=457007#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132667/new/
https://reviews.llvm.org/D132667
Files:
libcxx/CMakeLists.txt
libcxx/include/__format/format_error.h
libcxx/src/format.cpp
Index: libcxx/src/format.cpp
===================================================================
--- libcxx/src/format.cpp
+++ libcxx/src/format.cpp
@@ -10,6 +10,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
+#ifndef _LIBCPP_INLINE_FORMAT_ERROR_DTOR
format_error::~format_error() noexcept = default;
+#endif
_LIBCPP_END_NAMESPACE_STD
Index: libcxx/include/__format/format_error.h
===================================================================
--- libcxx/include/__format/format_error.h
+++ libcxx/include/__format/format_error.h
@@ -31,7 +31,14 @@
: runtime_error(__s) {}
_LIBCPP_HIDE_FROM_ABI explicit format_error(const char* __s)
: runtime_error(__s) {}
+ // TODO FMT Remove when format is no longer experimental.
+ // Avoids linker errors when building the Clang-cl Windows DLL which doesn't
+ // support the experimental library.
+# ifndef _LIBCPP_INLINE_FORMAT_ERROR_DTOR
~format_error() noexcept override;
+# else
+ ~format_error() noexcept override {}
+# endif
};
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void
Index: libcxx/CMakeLists.txt
===================================================================
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -832,6 +832,14 @@
# Use the ISO conforming behaviour for conversion
# in printf, scanf.
_CRT_STDIO_ISO_WIDE_SPECIFIERS)
+ # Clang-cl shared builds don't support the experimental library.
+ # To avoid linker errors the format_error destructor is inlined for the
+ # dylib. Users can never use format in this mode.
+ # TODO FMT Remove when format becomes mainline.
+ if (LIBCXX_ENABLE_SHARED)
+ target_compile_definitions(${target} PRIVATE
+ _LIBCPP_INLINE_FORMAT_ERROR_DTOR)
+ endif()
endif()
endfunction()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132667.457007.patch
Type: text/x-patch
Size: 1877 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220831/2a3e3a34/attachment.bin>
More information about the libcxx-commits
mailing list