external/skia/UnpackedTarball_skia.mk    |    1 
 external/skia/constexpr-template.patch.0 |   72 +++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+)

New commits:
commit 3307e4ae55d5286c37853a58ffaf582c7e16a2ba
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Tue Oct 25 14:33:39 2022 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Tue Oct 25 16:23:24 2022 +0200

    external/skia: 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/skia/src/sksl/dsl/DSLFunction.cpp:8:
    > In file included from 
workdir/UnpackedTarball/skia/include/sksl/DSLFunction.h:11:
    > In file included from 
workdir/UnpackedTarball/skia/include/private/SkSLDefines.h:14:
    > In file included from 
workdir/UnpackedTarball/skia/include/private/SkTArray.h:16:
    > In file included from 
workdir/UnpackedTarball/skia/include/private/SkTemplates.h:18:
    > 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 'SkSL::Expression'
    >     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<SkSL::Expression>::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<SkSL::Expression>::reset' 
requested here
    >   _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { 
reset(); }
    >                                                                           
^
    > workdir/UnpackedTarball/skia/include/sksl/DSLFunction.h:100:43: note: in 
instantiation of member function 
'std::unique_ptr<SkSL::Expression>::~unique_ptr' requested here
    >         args.push_back(DSLExpression(var).release());
    >                                           ^
    > workdir/UnpackedTarball/skia/include/private/SkSLDefines.h:21:7: note: 
forward declaration of 'SkSL::Expression'
    > class Expression;
    >       ^
    
    and
    
    > In file included from 
workdir/UnpackedTarball/skia/src/sksl/dsl/DSLVar.cpp:8:
    > In file included from 
workdir/UnpackedTarball/skia/include/sksl/DSLVar.h:11:
    > In file included from 
workdir/UnpackedTarball/skia/include/sksl/DSLExpression.h:11:
    > In file included from 
workdir/UnpackedTarball/skia/include/private/SkTArray.h:16:
    > In file included from 
workdir/UnpackedTarball/skia/include/private/SkTemplates.h:18:
    > 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 'SkSL::Statement'
    >     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<SkSL::Statement>::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<SkSL::Statement>::reset' 
requested here
    >   _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { 
reset(); }
    >                                                                           
^
    > workdir/UnpackedTarball/skia/include/sksl/DSLVar.h:38:5: note: in 
instantiation of member function 
'std::unique_ptr<SkSL::Statement>::~unique_ptr' requested here
    >     DSLVarBase() : fType(kVoid_Type), fDeclared(true) {}
    >     ^
    > workdir/UnpackedTarball/skia/include/private/SkSLDefines.h:22:7: note: 
forward declaration of 'SkSL::Statement'
    > class Statement;
    >       ^
    
    and
    
    > In file included from 
workdir/UnpackedTarball/skia/src/gpu/ganesh/effects/GrBlendFragmentProcessor.cpp:8:
    > In file included from 
workdir/UnpackedTarball/skia/src/gpu/ganesh/effects/GrBlendFragmentProcessor.h:12:
    > In file included from 
workdir/UnpackedTarball/skia/include/core/SkRefCnt.h:16:
    > 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 'GrFragmentProcessor'
    >     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<GrFragmentProcessor>::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<GrFragmentProcessor>::reset' 
requested here
    >   _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { 
reset(); }
    >                                                                           
^
    > 
workdir/UnpackedTarball/skia/src/gpu/ganesh/effects/GrBlendFragmentProcessor.h:36:17:
 note: in instantiation of member function 
'std::unique_ptr<GrFragmentProcessor>::~unique_ptr' requested here
    >     return Make(std::move(src), std::move(dst), mode, 
/*shareBlendLogic=*/false);
    >                 ^
    > 
workdir/UnpackedTarball/skia/src/gpu/ganesh/effects/GrBlendFragmentProcessor.h:14:7:
 note: forward declaration of 'GrFragmentProcessor'
    > class GrFragmentProcessor;
    >       ^
    
    Change-Id: I47f7280af3de7ed7b1915d4e5d2f7b52e4f26a9a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141815
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/external/skia/UnpackedTarball_skia.mk 
b/external/skia/UnpackedTarball_skia.mk
index 7670b7798fbd..829df782fb90 100644
--- a/external/skia/UnpackedTarball_skia.mk
+++ b/external/skia/UnpackedTarball_skia.mk
@@ -38,6 +38,7 @@ skia_patches := \
     allow-no-es2restrictions.patch.1 \
     vk_mem_alloc.patch.1 \
     tdf148624.patch.1 \
+    constexpr-template.patch.0 \
 
 $(eval $(call gb_UnpackedTarball_set_patchlevel,skia,1))
 
diff --git a/external/skia/constexpr-template.patch.0 
b/external/skia/constexpr-template.patch.0
new file mode 100644
index 000000000000..883f31e0f1b6
--- /dev/null
+++ b/external/skia/constexpr-template.patch.0
@@ -0,0 +1,72 @@
+--- include/sksl/DSLFunction.h
++++ include/sksl/DSLFunction.h
+@@ -93,17 +93,20 @@
+     DSLExpression call(ExpressionArray args, Position pos = {});
+ 
+ private:
++    static void push_back(ExpressionArray& args, DSLExpression& expr);
++
+     void collectArgs(ExpressionArray& args) {}
+ 
+     template<class... RemainingArgs>
+     void collectArgs(ExpressionArray& args, DSLVar& var, RemainingArgs&&... 
remaining) {
+-        args.push_back(DSLExpression(var).release());
++        DSLExpression expr(var);
++        push_back(args, expr);
+         collectArgs(args, std::forward<RemainingArgs>(remaining)...);
+     }
+ 
+     template<class... RemainingArgs>
+     void collectArgs(ExpressionArray& args, DSLExpression expr, 
RemainingArgs&&... remaining) {
+-        args.push_back(expr.release());
++        push_back(args, expr);
+         collectArgs(args, std::forward<RemainingArgs>(remaining)...);
+     }
+ 
+--- include/sksl/DSLVar.h
++++ include/sksl/DSLVar.h
+@@ -35,7 +35,7 @@
+     /**
+      * Creates an empty, unpopulated var. Can be replaced with a real var 
later via `swap`.
+      */
+-    DSLVarBase() : fType(kVoid_Type), fDeclared(true) {}
++    DSLVarBase();
+ 
+     /**
+      * Constructs a new variable with the specified type and name. The name 
is used (in mangled
+--- src/gpu/ganesh/effects/GrBlendFragmentProcessor.h
++++ src/gpu/ganesh/effects/GrBlendFragmentProcessor.h
+@@ -10,8 +10,7 @@
+ 
+ #include "include/core/SkBlendMode.h"
+ #include "include/core/SkRefCnt.h"
+-
+-class GrFragmentProcessor;
++#include "src/gpu/ganesh/GrFragmentProcessor.h"
+ 
+ namespace GrBlendFragmentProcessor {
+ 
+--- src/sksl/dsl/DSLFunction.cpp
++++ src/sksl/dsl/DSLFunction.cpp
+@@ -34,6 +34,10 @@
+ 
+ namespace dsl {
+ 
++void DSLFunction::push_back(ExpressionArray& args, DSLExpression& expr) {
++    args.push_back(expr.release());
++}
++
+ void DSLFunction::init(DSLModifiers modifiers, const DSLType& returnType, 
std::string_view name,
+                        SkTArray<DSLParameter*> params, Position pos) {
+     fPosition = pos;
+--- src/sksl/dsl/DSLVar.cpp
++++ src/sksl/dsl/DSLVar.cpp
+@@ -46,6 +46,8 @@
+ 
+ namespace dsl {
+ 
++DSLVarBase::DSLVarBase() : fType(kVoid_Type), fDeclared(true) {}
++
+ DSLVarBase::DSLVarBase(DSLType type, std::string_view name, DSLExpression 
initialValue,
+                        Position pos, Position namePos)
+     : DSLVarBase(DSLModifiers(), std::move(type), name, 
std::move(initialValue), pos, namePos) {}

Reply via email to