Backport another libc++ patch for std::filesystem (and locale) usage

This fixes linking against a DLL of libc++ while using the common headers
(generated from the static version of the library, but which work for
both shared and static versions) when calling e.g. std::filesystem::u8path.
This commit is contained in:
Martin Storsjö committed 2021-05-25 23:55:32 +03:00
1 parent 168cc5f53d
commit 657d12c8a5
25 files changed
+122 -24

No files matched your search

@@ -1,7 +1,7 @@
From 4655075efa11ee17c28493d13760d51e360f7ddd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Wed, 4 Nov 2020 16:59:07 +0200
Subject: [PATCH 01/24] [libcxx] Implement the stat function family on top of
Subject: [PATCH 01/25] [libcxx] Implement the stat function family on top of
native windows APIs
While the windows CRTs (the modern UCRT, and the legacy msvcrt.dll
@@ -1,7 +1,7 @@
From ab432bcd28596265e97eb062a19cbbbdc3d426f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Wed, 4 Nov 2020 22:56:03 +0200
Subject: [PATCH 02/24] [libcxx] Implement _FilesystemClock::now() and
Subject: [PATCH 02/25] [libcxx] Implement _FilesystemClock::now() and
__last_write_time for windows
Differential Revision: https://reviews.llvm.org/D91142
@@ -1,7 +1,7 @@
From 13bc151ad49587f94a123cdb3e2ba770c1513d9d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Fri, 6 Nov 2020 11:16:30 +0200
Subject: [PATCH 03/24] [libcxx] Hook up a number of operation functions to
Subject: [PATCH 03/25] [libcxx] Hook up a number of operation functions to
their windows counterparts
Use the corresponding wchar functions, named "_wfunc" instead of "func",
@@ -1,7 +1,7 @@
From 21ffff20ef2e05f8c99bd120d7b1212d75f14dcd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Mon, 9 Nov 2020 15:20:18 +0200
Subject: [PATCH 04/24] [libcxx] Sanitize paths before creating symlinks on
Subject: [PATCH 04/25] [libcxx] Sanitize paths before creating symlinks on
windows
The MS STL does even more cleanup (corresponding to lexically_normal
@@ -1,7 +1,7 @@
From 51a0f3a5af65c8e8e1618dc5621705471aba2151 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Wed, 4 Nov 2020 23:32:13 +0200
Subject: [PATCH 05/24] [libcxx] Implement the space function for windows
Subject: [PATCH 05/25] [libcxx] Implement the space function for windows
Differential Revision: https://reviews.llvm.org/D91168
@@ -1,7 +1,7 @@
From 0bdb2f73e8ba72de291d1ca95363835ab538bdab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Wed, 4 Nov 2020 23:46:12 +0200
Subject: [PATCH 06/24] [libcxx] Implement the current_path function for
Subject: [PATCH 06/25] [libcxx] Implement the current_path function for
windows
Differential Revision: https://reviews.llvm.org/D91169
@@ -1,7 +1,7 @@
From b6ef948856bfde6326ebc2d1fddc24890b4182f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Wed, 4 Nov 2020 23:51:12 +0200
Subject: [PATCH 07/24] [libcxx] Implement the canonical function for windows
Subject: [PATCH 07/25] [libcxx] Implement the canonical function for windows
Differential Revision: https://reviews.llvm.org/D91170
@@ -1,7 +1,7 @@
From 96748da73f57e6b080643d03e41e8a690ee571a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Wed, 4 Nov 2020 23:55:10 +0200
Subject: [PATCH 08/24] [libcxx] Implement the permissions function for windows
Subject: [PATCH 08/25] [libcxx] Implement the permissions function for windows
Differential Revision: https://reviews.llvm.org/D91171
@@ -1,7 +1,7 @@
From f28542330202fae54a6fee1bf02a311feef3f60a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Wed, 4 Nov 2020 23:51:18 +0200
Subject: [PATCH 09/24] [libcxx] Implement the read_symlink function for
Subject: [PATCH 09/25] [libcxx] Implement the read_symlink function for
windows
Differential Revision: https://reviews.llvm.org/D91172
@@ -1,7 +1,7 @@
From 6f225c9fca50bda8911a4909b3cbf0eb28733384 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Fri, 30 Oct 2020 22:24:25 +0200
Subject: [PATCH 10/24] [libcxx] Use the posix code for
Subject: [PATCH 10/25] [libcxx] Use the posix code for
directory_entry::__do_refresh
This works just fine for windows, as all the functions it calls
@@ -1,7 +1,7 @@
From 3474a416fef709f218ff5897842819d379495cad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Thu, 29 Oct 2020 12:10:26 +0200
Subject: [PATCH 11/24] [libcxx] Implement temp_directory_path using
Subject: [PATCH 11/25] [libcxx] Implement temp_directory_path using
GetTempPath on windows
This does roughly the same as the manual implementation, but checks
@@ -1,7 +1,7 @@
From 3f12aeb4ae3fd43d98f0c698952713d9fef7bef3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Tue, 3 Nov 2020 23:52:32 +0200
Subject: [PATCH 12/24] [libcxx] Implement parsing of root_name for paths on
Subject: [PATCH 12/25] [libcxx] Implement parsing of root_name for paths on
windows
Differential Revision: https://reviews.llvm.org/D91176
@@ -1,7 +1,7 @@
From bd50990c64deae4ce6027767659c75a22822e2f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Sun, 1 Nov 2020 23:39:03 +0200
Subject: [PATCH 13/24] [libcxx] Implement is_absolute properly for windows
Subject: [PATCH 13/25] [libcxx] Implement is_absolute properly for windows
Differential Revision: https://reviews.llvm.org/D91177
@@ -1,7 +1,7 @@
From bd884f520faaa41618d6e901e1631ff02fab3044 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Wed, 4 Nov 2020 15:59:56 +0200
Subject: [PATCH 14/24] [libcxx] Implement append and operator/ properly for
Subject: [PATCH 14/25] [libcxx] Implement append and operator/ properly for
windows
The root_path function has to be changed to return the parsed bit
@@ -1,7 +1,7 @@
From 6131abb23fc2990f9a869ef3d9c63bb0fd5ff464 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Thu, 5 Nov 2020 23:09:15 +0200
Subject: [PATCH 15/24] [libcxx] Have lexically_normal return the path with
Subject: [PATCH 15/25] [libcxx] Have lexically_normal return the path with
preferred separators
Differential Revision: https://reviews.llvm.org/D91179
@@ -1,7 +1,7 @@
From 415ea201cb19775f253dfb0cf8dc561891cff02d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Mon, 9 Nov 2020 11:45:13 +0200
Subject: [PATCH 16/24] [libcxx] Make generic_*string return paths with forward
Subject: [PATCH 16/25] [libcxx] Make generic_*string return paths with forward
slashes on windows
This matches what MS STL returns; in std::filesystem, forward slashes
@@ -1,7 +1,7 @@
From c8c08547b2d1e87391213846c7e17f5426a3dd48 Mon Sep 17 00:00:00 2001
From: Zbigniew Sarbinowski <zibi@ca.ibm.com>
Date: Thu, 18 Feb 2021 14:49:46 +0000
Subject: [PATCH 17/24] [SystemZ][ZOS] Guard using declaration for ::fchmodat
Subject: [PATCH 17/25] [SystemZ][ZOS] Guard using declaration for ::fchmodat
The use of fchmodat() is beeing guarded but its using declaration is not. Let's use the same guard in both places to avoid compiler errors on platforms where `fchmodat` does not exist.
@@ -1,7 +1,7 @@
From ff2e16fe051405232fbd9a09c406767b229d27ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Thu, 5 Nov 2020 00:13:22 +0200
Subject: [PATCH 18/24] [libcxx] Enable filesystem by default for mingw targets
Subject: [PATCH 18/25] [libcxx] Enable filesystem by default for mingw targets
This feature can be built successfully for windows now. However,
the helper functions for __int128_t aren't available in MSVC
@@ -1,7 +1,7 @@
From 69856f3e59b210249020504329e016c691f138e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Fri, 18 Dec 2020 13:34:35 +0200
Subject: [PATCH 19/24] [libcxx] Explicitly return the expected error code in
Subject: [PATCH 19/25] [libcxx] Explicitly return the expected error code in
create_directories if the parent isn't a directory
On windows, going ahead and actually trying to create the directory
@@ -1,7 +1,7 @@
From 6c968da9f1e9281055d31f66c292f81de204924d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Sat, 27 Feb 2021 19:12:25 +0200
Subject: [PATCH 20/24] [libcxx] Avoid infinite recursion in
Subject: [PATCH 20/25] [libcxx] Avoid infinite recursion in
create_directories, if the root directory doesn't exist
Differential Revision: https://reviews.llvm.org/D97618
@@ -1,7 +1,7 @@
From cd87c3f6b36fd6cd991b8e3a3ac85dc208d55ea1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Sat, 27 Feb 2021 16:09:49 +0200
Subject: [PATCH 21/24] [libcxx] Map ERROR_BAD_PATHNAME to
Subject: [PATCH 21/25] [libcxx] Map ERROR_BAD_PATHNAME to
errc::no_such_file_or_directory on windows
Opening a path like \\server (without a trailing share name and
@@ -1,7 +1,7 @@
From 497842a9ebb0ca1a6f871a07c0f4b4f1c700a798 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Thu, 11 Mar 2021 13:06:08 +0200
Subject: [PATCH 22/24] [libcxx] Avoid intermediate string objects for
Subject: [PATCH 22/25] [libcxx] Avoid intermediate string objects for
substrings in windows operator/=
Check that appends with a path object doesn't do allocations, even
@@ -1,7 +1,7 @@
From 9a1bb266e38b31c78de03abc2d41cdd3245595d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Mon, 8 Mar 2021 12:03:30 +0200
Subject: [PATCH 23/24] [libcxx] Test accessing a directory on windows that
Subject: [PATCH 23/25] [libcxx] Test accessing a directory on windows that
gives "access denied" errors
Fix handling of skip_permission_denied on windows; after converting
@@ -1,7 +1,7 @@
From 7a94808f488301270f4a55ff7a17a8ebff3d388c Mon Sep 17 00:00:00 2001
From: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
Date: Fri, 5 Mar 2021 20:13:35 -0500
Subject: [PATCH 24/24] [libc++] Improve src/filesystem's formatting of paths.
Subject: [PATCH 24/25] [libc++] Improve src/filesystem's formatting of paths.
This is my attempt to merge D98077 (bugfix the format strings for
Windows paths, which use wchar_t not char)
@@ -0,0 +1,98 @@
From 138e1609764e2226938df8cd6176303b41e4f325 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Tue, 18 May 2021 14:45:08 +0000
Subject: [PATCH 25/25] [libcxx] Make the visibility attributes consistent for
__narrow_to_utf8/__widen_from_utf8
Use the same visiblity attributes as for all other template
specializations in the same file; declare the specialization itself
using _LIBCPP_TYPE_VIS, and don't use _LIBCPP_EXPORTED_FROM_ABI on
the destructor. Methods that are excluded from the ABI are marked
with _LIBCPP_INLINE_VISIBILITY.
This makes the vtable exported from DLL builds of libc++. Practically,
it doesn't make any difference for the CI configuration, but it
can make a difference in mingw setups.
Differential Revision: https://reviews.llvm.org/D102717
(cherry picked from commit 3a6be27978aa3e83e9dc2ff2402b2569ce0686fd)
---
libcxx/include/__locale | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/libcxx/include/__locale b/libcxx/include/__locale
index 77e5faab2676..c2800e88e8d2 100644
--- a/libcxx/include/__locale
+++ b/libcxx/include/__locale
@@ -1484,14 +1484,14 @@ struct __narrow_to_utf8<8>
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-struct _LIBCPP_TEMPLATE_VIS __narrow_to_utf8<16>
+struct _LIBCPP_TYPE_VIS __narrow_to_utf8<16>
: public codecvt<char16_t, char, mbstate_t>
{
_LIBCPP_INLINE_VISIBILITY
__narrow_to_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
_LIBCPP_SUPPRESS_DEPRECATED_POP
- _LIBCPP_EXPORTED_FROM_ABI ~__narrow_to_utf8();
+ ~__narrow_to_utf8();
template <class _OutputIterator, class _CharT>
_LIBCPP_INLINE_VISIBILITY
@@ -1520,14 +1520,14 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-struct _LIBCPP_TEMPLATE_VIS __narrow_to_utf8<32>
+struct _LIBCPP_TYPE_VIS __narrow_to_utf8<32>
: public codecvt<char32_t, char, mbstate_t>
{
_LIBCPP_INLINE_VISIBILITY
__narrow_to_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
_LIBCPP_SUPPRESS_DEPRECATED_POP
- _LIBCPP_EXPORTED_FROM_ABI ~__narrow_to_utf8();
+ ~__narrow_to_utf8();
template <class _OutputIterator, class _CharT>
_LIBCPP_INLINE_VISIBILITY
@@ -1578,14 +1578,14 @@ struct __widen_from_utf8<8>
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<16>
+struct _LIBCPP_TYPE_VIS __widen_from_utf8<16>
: public codecvt<char16_t, char, mbstate_t>
{
_LIBCPP_INLINE_VISIBILITY
__widen_from_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
_LIBCPP_SUPPRESS_DEPRECATED_POP
- _LIBCPP_EXPORTED_FROM_ABI ~__widen_from_utf8();
+ ~__widen_from_utf8();
template <class _OutputIterator>
_LIBCPP_INLINE_VISIBILITY
@@ -1614,14 +1614,14 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<32>
+struct _LIBCPP_TYPE_VIS __widen_from_utf8<32>
: public codecvt<char32_t, char, mbstate_t>
{
_LIBCPP_INLINE_VISIBILITY
__widen_from_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
_LIBCPP_SUPPRESS_DEPRECATED_POP
- _LIBCPP_EXPORTED_FROM_ABI ~__widen_from_utf8();
+ ~__widen_from_utf8();
template <class _OutputIterator>
_LIBCPP_INLINE_VISIBILITY
--
2.25.1