summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-06-23 13:48:24 +0200
committerStephan Bergmann <sbergman@redhat.com>2022-06-23 15:27:13 +0200
commita2fad16357309f1eba4346dc826bc5ad7012b1aa (patch)
tree9337119f7c04f8e0a2c1307089122608f5121a06 /external
parent74d545ee8e4f8c9a1317decd3352ce97e0e24913 (diff)
external/pdfium: Adapt bundled abseil-cpp to Clang 15 trunk change
...<https://github.com/llvm/llvm-project/commit/5ea341d7c4f9cc4933adc04ff74d59e26ad2f306> "[clang] Fix trivially copyable for copy constructor and copy assignment operator", which caused my build on Windows with clang-cl against the MSVC standard library to fail with > In file included from workdir/UnpackedTarball/pdfium/core/fxge/win32/cgdi_plus_ext.cpp:19: > In file included from workdir/UnpackedTarball/pdfium\core/fxcrt/fx_string.h:14: > In file included from workdir/UnpackedTarball/pdfium\core/fxcrt/bytestring.h:23: > In file included from workdir/UnpackedTarball/pdfium\core/fxcrt/string_view_template.h:18: > In file included from workdir/UnpackedTarball/pdfium\third_party/abseil-cpp/absl/types/optional.h:39: > In file included from workdir/UnpackedTarball/pdfium/third_party/abseil-cpp\absl/utility/utility.h:51: > workdir/UnpackedTarball/pdfium/third_party/abseil-cpp\absl/meta/type_traits.h(501,3): error: static_assert failed due to requirement 'compliant || std::is_trivially_copy_assignable<std::pair<unsigned long long, unsigned long long>>::value' "Not compliant with std::is_trivially_copy_assignable; Standard: false, Implementation: true" > static_assert(compliant || std::is_trivially_copy_assignable<T>::value, > ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > workdir/UnpackedTarball/pdfium/third_party/abseil-cpp\absl/types/internal/optional.h(175,21): note: in instantiation of template class 'absl::is_trivially_copy_assignable<std::pair<unsigned long long, unsigned long long>>' requested here > absl::is_trivially_copy_assignable<typename std::remove_cv< > ^ > workdir/UnpackedTarball/pdfium\third_party/abseil-cpp/absl/types/optional.h(119,45): note: in instantiation of default argument for 'optional_data<std::pair<unsigned long long, unsigned long long>>' required here > class optional : private optional_internal::optional_data<T>, > ^~~~~~~~~~~~~~~~ > workdir/UnpackedTarball/pdfium/core/fxge/win32/cgdi_plus_ext.cpp(384,43): note: in instantiation of template class 'absl::optional<std::pair<unsigned long long, unsigned long long>>' requested here > absl::optional<std::pair<size_t, size_t>> IsSmallTriangle( > ^ because the behavior of Clang's built-in __has_trivial_assign no longer matches the behavior of std::is_trivially_copy_assignable for std::pair, which in MSVC happens to be implemented with a deleted copy assignment op > pair& operator=(const volatile pair&) = delete; in c:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/include/utility. (See the comments starting at <https://reviews.llvm.org/D127593#3596601> "[clang] Fix trivially copyable for copy constructor and copy assignment operator" for further details.) The easiest workaround appears to be to switch the implementation of absl::is_trivially_copy_assignable from __has_trivial_assign to std::is_trivially_copy_assignable, which should always be available in our C++17-based toolchain baselines. Change-Id: I5d9c3c4fd95852e57d93b56752b7e64d6d71d153 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136335 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'external')
-rw-r--r--external/pdfium/UnpackedTarball_pdfium.mk2
-rw-r--r--external/pdfium/abseil-trivial.patch27
2 files changed, 29 insertions, 0 deletions
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk
index 06b94e4d064d..072d45b4767b 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -26,6 +26,8 @@ pdfium_patches += gcc-c++20-comparison.patch
pdfium_patches += include.patch
+pdfium_patches += abseil-trivial.patch
+
$(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium))
$(eval $(call gb_UnpackedTarball_set_tarball,pdfium,$(PDFIUM_TARBALL)))
diff --git a/external/pdfium/abseil-trivial.patch b/external/pdfium/abseil-trivial.patch
new file mode 100644
index 000000000000..f3e929a5843a
--- /dev/null
+++ b/external/pdfium/abseil-trivial.patch
@@ -0,0 +1,27 @@
+--- third_party/abseil-cpp/absl/meta/type_traits.h
++++ third_party/abseil-cpp/absl/meta/type_traits.h
+@@ -489,23 +489,7 @@
+ // operation that is not trivial. `is_trivially_copy_assignable<T>` is simply
+ // `is_trivially_assignable<T&, const T&>`.
+ template <typename T>
+-struct is_trivially_copy_assignable
+- : std::integral_constant<
+- bool, __has_trivial_assign(typename std::remove_reference<T>::type) &&
+- absl::is_copy_assignable<T>::value> {
+-#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
+- private:
+- static constexpr bool compliant =
+- std::is_trivially_copy_assignable<T>::value ==
+- is_trivially_copy_assignable::value;
+- static_assert(compliant || std::is_trivially_copy_assignable<T>::value,
+- "Not compliant with std::is_trivially_copy_assignable; "
+- "Standard: false, Implementation: true");
+- static_assert(compliant || !std::is_trivially_copy_assignable<T>::value,
+- "Not compliant with std::is_trivially_copy_assignable; "
+- "Standard: true, Implementation: false");
+-#endif // ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
+-};
++using is_trivially_copy_assignable = std::is_trivially_copy_assignable<T>;
+
+ #if defined(__cpp_lib_remove_cvref) && __cpp_lib_remove_cvref >= 201711L
+ template <typename T>