summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-10-25 14:32:13 +0200
committerStephan Bergmann <sbergman@redhat.com>2022-10-25 16:22:30 +0200
commitd1b867e42e0097cdbc7097e7c8eb83da8885ec4f (patch)
tree4b3d4af10192c18d54a45bb3175c08b1d47f0c8e /external
parent3c5a98135fe55bf48cfd11b4e163906fbfe0d115 (diff)
external/pdfium: Address a constexpr template point of instantiation issue
...that hits at least when building with Clang and --with-latest-c++ against recent libc++ or MSVC standard library (where C++20 and esp. C++23 made more and more class template member functions constexpr). My understanding is that there is some leeway at what point a compiler should instantiate such function specializations, and Clang decides to instantiate constexpr ones early (cf. <https://github.com/llvm/llvm-project/commit/242ad89a15d5466d166d47978bfff983d40ab511> "C++11 half of r147023: In C++11, additionally eagerly instantiate:" and its "Do not defer instantiations of constexpr functions" comment, and the discussion at <https://discourse.llvm.org/t/point-of-instantiation-of-constexpr-function-template/65129>). > In file included from workdir/UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_SymbolDict.cpp:7: > In file included from workdir/UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_SymbolDict.h:10: > In file included from ~/llvm/inst/bin/../include/c++/v1/memory:881: > In file included from ~/llvm/inst/bin/../include/c++/v1/__memory/shared_ptr.h:30: > ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:47:19: error: invalid application of 'sizeof' to an incomplete type 'CJBig2_Image' > static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type"); > ^~~~~~~~~~~ > ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:281:7: note: in instantiation of member function 'std::default_delete<CJBig2_Image>::operator()' requested here > __ptr_.second()(__tmp); > ^ > ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:247:75: note: in instantiation of member function 'std::unique_ptr<CJBig2_Image>::reset' requested here > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); } > ^ > ~/llvm/inst/bin/../include/c++/v1/__memory/construct_at.h:64:13: note: in instantiation of member function 'std::unique_ptr<CJBig2_Image>::~unique_ptr' requested here > __loc->~_Tp(); > ^ > ~/llvm/inst/bin/../include/c++/v1/__memory/construct_at.h:89:12: note: in instantiation of function template specialization 'std::__destroy_at<std::unique_ptr<CJBig2_Image>, 0>' requested here > _VSTD::__destroy_at(__loc); > ^ > ~/llvm/inst/bin/../include/c++/v1/__memory/allocator_traits.h:317:16: note: in instantiation of function template specialization 'std::destroy_at<std::unique_ptr<CJBig2_Image>, 0>' requested here > _VSTD::destroy_at(__p); > ^ > ~/llvm/inst/bin/../include/c++/v1/__split_buffer:304:25: note: in instantiation of function template specialization 'std::allocator_traits<std::allocator<std::unique_ptr<CJBig2_Image>>>::destroy<std::unique_ptr<CJBig2_Image>, void, void>' requested here > __alloc_traits::destroy(__alloc(), _VSTD::__to_address(--__end_)); > ^ > ~/llvm/inst/bin/../include/c++/v1/__split_buffer:145:10: note: in instantiation of member function 'std::__split_buffer<std::unique_ptr<CJBig2_Image>, std::allocator<std::unique_ptr<CJBig2_Image>> &>::__destruct_at_end' requested here > {__destruct_at_end(__new_last, false_type());} > ^ > ~/llvm/inst/bin/../include/c++/v1/__split_buffer:103:10: note: in instantiation of member function 'std::__split_buffer<std::unique_ptr<CJBig2_Image>, std::allocator<std::unique_ptr<CJBig2_Image>> &>::__destruct_at_end' requested here > {__destruct_at_end(__begin_);} > ^ > ~/llvm/inst/bin/../include/c++/v1/__split_buffer:361:5: note: in instantiation of member function 'std::__split_buffer<std::unique_ptr<CJBig2_Image>, std::allocator<std::unique_ptr<CJBig2_Image>> &>::clear' requested here > clear(); > ^ > ~/llvm/inst/bin/../include/c++/v1/vector:1536:49: note: in instantiation of member function 'std::__split_buffer<std::unique_ptr<CJBig2_Image>, std::allocator<std::unique_ptr<CJBig2_Image>> &>::~__split_buffer' requested here > __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a); > ^ > ~/llvm/inst/bin/../include/c++/v1/vector:1568:9: note: in instantiation of function template specialization 'std::vector<std::unique_ptr<CJBig2_Image>>::__push_back_slow_path<std::unique_ptr<CJBig2_Image>>' requested here > __push_back_slow_path(std::move(__x)); > ^ > workdir/UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_SymbolDict.h:26:16: note: in instantiation of member function 'std::vector<std::unique_ptr<CJBig2_Image>>::push_back' requested here > m_SDEXSYMS.push_back(std::move(image)); > ^ > workdir/UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_SymbolDict.h:16:7: note: forward declaration of 'CJBig2_Image' > class CJBig2_Image; > ^ Change-Id: Ibaeb72eefdd58ca39ffa6bb8f6c5d7088ce51ab7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141812 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/constexpr-template.patch12
2 files changed, 14 insertions, 0 deletions
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk
index 92a4dad436ee..3c82926acee1 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -33,6 +33,8 @@ pdfium_patches += Add-FPDFAnnot_GetFormAdditionalActionJavaScript-API.patch.1
# https://pdfium-review.googlesource.com/c/pdfium/+/98210
pdfium_patches += Add-FPDFAnnot_GetFormFieldAlternateName-API.patch.1
+pdfium_patches += constexpr-template.patch
+
$(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium))
$(eval $(call gb_UnpackedTarball_set_tarball,pdfium,$(PDFIUM_TARBALL)))
diff --git a/external/pdfium/constexpr-template.patch b/external/pdfium/constexpr-template.patch
new file mode 100644
index 000000000000..b83b9f106a32
--- /dev/null
+++ b/external/pdfium/constexpr-template.patch
@@ -0,0 +1,12 @@
+--- core/fxcodec/jbig2/JBig2_SymbolDict.h
++++ core/fxcodec/jbig2/JBig2_SymbolDict.h
+@@ -12,8 +12,7 @@
+ #include <vector>
+
+ #include "core/fxcodec/jbig2/JBig2_ArithDecoder.h"
+-
+-class CJBig2_Image;
++#include "core/fxcodec/jbig2/JBig2_Image.h"
+
+ class CJBig2_SymbolDict {
+ public: