git: 743cdc309608 - main - www/webkit2-gtk3: fix build with clang 19

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Mon, 12 Aug 2024 19:39:24 UTC
The branch main has been updated by dim:

URL: https://cgit.FreeBSD.org/ports/commit/?id=743cdc3096083c022157d3da0291a878f1f8b58b

commit 743cdc3096083c022157d3da0291a878f1f8b58b
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-08-10 11:50:00 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-08-12 19:37:36 +0000

    www/webkit2-gtk3: fix build with clang 19
    
    Clang 19 now implements CWG 96 [1], which requires a template argument
    list after a 'template' keyword, resulting in errors similar to:
    
        /wrkdirs/usr/ports/www/webkit2-gtk3/work/webkitgtk-2.34.6/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h:974:65: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
          974 |         AssemblerType::repatchCompact(dataLabelCompact.template dataLocation(), value);
              |                                                                 ^
    
    In these cases, appending "<>" is enough to satisfy the constraint.
    Upstream has committed a fix to their main branch [2], but since some
    code has moved around, and other functions have been removed, it does
    not apply cleanly to 2.34.6. Therefore, apply only the necessary fixes
    manually for now.
    
    [1] https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#96
    [2] https://github.com/WebKit/WebKit/commit/62b6e2db547e
    
    PR:             280728
    Approved by:    fluffy (maintainer)
    MFH:            2024Q3
---
 ...vaScriptCore_assembler_AbstractMacroAssembler.h | 11 +++++
 .../patch-Source_JavaScriptCore_llint_LLIntData.h  | 56 ++++++++++++++++++++++
 .../patch-Source_JavaScriptCore_runtime_JSCast.h   | 20 ++++++++
 3 files changed, 87 insertions(+)

diff --git a/www/webkit2-gtk3/files/patch-Source_JavaScriptCore_assembler_AbstractMacroAssembler.h b/www/webkit2-gtk3/files/patch-Source_JavaScriptCore_assembler_AbstractMacroAssembler.h
new file mode 100644
index 000000000000..9e70156211dd
--- /dev/null
+++ b/www/webkit2-gtk3/files/patch-Source_JavaScriptCore_assembler_AbstractMacroAssembler.h
@@ -0,0 +1,11 @@
+--- Source/JavaScriptCore/assembler/AbstractMacroAssembler.h.orig	2021-10-21 08:52:07 UTC
++++ Source/JavaScriptCore/assembler/AbstractMacroAssembler.h
+@@ -971,7 +971,7 @@ class AbstractMacroAssembler : public AbstractMacroAss
+     template<PtrTag tag>
+     static void repatchCompact(CodeLocationDataLabelCompact<tag> dataLabelCompact, int32_t value)
+     {
+-        AssemblerType::repatchCompact(dataLabelCompact.template dataLocation(), value);
++        AssemblerType::repatchCompact(dataLabelCompact.template dataLocation<>(), value);
+     }
+ 
+     template<PtrTag tag>
diff --git a/www/webkit2-gtk3/files/patch-Source_JavaScriptCore_llint_LLIntData.h b/www/webkit2-gtk3/files/patch-Source_JavaScriptCore_llint_LLIntData.h
new file mode 100644
index 000000000000..614316d74a1f
--- /dev/null
+++ b/www/webkit2-gtk3/files/patch-Source_JavaScriptCore_llint_LLIntData.h
@@ -0,0 +1,56 @@
+--- Source/JavaScriptCore/llint/LLIntData.h.orig	2021-10-21 08:52:07 UTC
++++ Source/JavaScriptCore/llint/LLIntData.h
+@@ -217,7 +217,7 @@ ALWAYS_INLINE LLIntCode getCodeFunctionPtr(OpcodeID op
+ #if COMPILER(MSVC)
+     return reinterpret_cast<LLIntCode>(getCodePtr<tag>(opcodeID).executableAddress());
+ #else
+-    return reinterpret_cast<LLIntCode>(getCodePtr<tag>(opcodeID).template executableAddress());
++    return reinterpret_cast<LLIntCode>(getCodePtr<tag>(opcodeID).template executableAddress<>());
+ #endif
+ }
+ 
+@@ -227,7 +227,7 @@ ALWAYS_INLINE LLIntCode getWide16CodeFunctionPtr(Opcod
+ #if COMPILER(MSVC)
+     return reinterpret_cast<LLIntCode>(getWide16CodePtr<tag>(opcodeID).executableAddress());
+ #else
+-    return reinterpret_cast<LLIntCode>(getWide16CodePtr<tag>(opcodeID).template executableAddress());
++    return reinterpret_cast<LLIntCode>(getWide16CodePtr<tag>(opcodeID).template executableAddress<>());
+ #endif
+ }
+ 
+@@ -237,7 +237,7 @@ ALWAYS_INLINE LLIntCode getWide32CodeFunctionPtr(Opcod
+ #if COMPILER(MSVC)
+     return reinterpret_cast<LLIntCode>(getWide32CodePtr<tag>(opcodeID).executableAddress());
+ #else
+-    return reinterpret_cast<LLIntCode>(getWide32CodePtr<tag>(opcodeID).template executableAddress());
++    return reinterpret_cast<LLIntCode>(getWide32CodePtr<tag>(opcodeID).template executableAddress<>());
+ #endif
+ }
+ 
+@@ -328,7 +328,7 @@ ALWAYS_INLINE LLIntCode getCodeFunctionPtr(WasmOpcodeI
+ #if COMPILER(MSVC)
+     return reinterpret_cast<LLIntCode>(getCodePtr<tag>(opcodeID).executableAddress());
+ #else
+-    return reinterpret_cast<LLIntCode>(getCodePtr<tag>(opcodeID).template executableAddress());
++    return reinterpret_cast<LLIntCode>(getCodePtr<tag>(opcodeID).template executableAddress<>());
+ #endif
+ }
+ 
+@@ -338,7 +338,7 @@ ALWAYS_INLINE LLIntCode getWide16CodeFunctionPtr(WasmO
+ #if COMPILER(MSVC)
+     return reinterpret_cast<LLIntCode>(getWide16CodePtr<tag>(opcodeID).executableAddress());
+ #else
+-    return reinterpret_cast<LLIntCode>(getWide16CodePtr<tag>(opcodeID).template executableAddress());
++    return reinterpret_cast<LLIntCode>(getWide16CodePtr<tag>(opcodeID).template executableAddress<>());
+ #endif
+ }
+ 
+@@ -348,7 +348,7 @@ ALWAYS_INLINE LLIntCode getWide32CodeFunctionPtr(WasmO
+ #if COMPILER(MSVC)
+     return reinterpret_cast<LLIntCode>(getWide32CodePtr<tag>(opcodeID).executableAddress());
+ #else
+-    return reinterpret_cast<LLIntCode>(getWide32CodePtr<tag>(opcodeID).template executableAddress());
++    return reinterpret_cast<LLIntCode>(getWide32CodePtr<tag>(opcodeID).template executableAddress<>());
+ #endif
+ }
+ 
diff --git a/www/webkit2-gtk3/files/patch-Source_JavaScriptCore_runtime_JSCast.h b/www/webkit2-gtk3/files/patch-Source_JavaScriptCore_runtime_JSCast.h
new file mode 100644
index 000000000000..94af6690b9b3
--- /dev/null
+++ b/www/webkit2-gtk3/files/patch-Source_JavaScriptCore_runtime_JSCast.h
@@ -0,0 +1,20 @@
+--- Source/JavaScriptCore/runtime/JSCast.h.orig	2021-10-21 08:52:07 UTC
++++ Source/JavaScriptCore/runtime/JSCast.h
+@@ -171,7 +171,7 @@ bool inherits(VM& vm, From* from)
+ bool inherits(VM& vm, From* from)
+ {
+     using Dispatcher = InheritsTraits<Target>;
+-    return Dispatcher::template inherits(vm, from);
++    return Dispatcher::template inherits<>(vm, from);
+ }
+ 
+ } // namespace JSCastingHelpers
+@@ -180,7 +180,7 @@ To jsDynamicCast(VM& vm, From* from)
+ To jsDynamicCast(VM& vm, From* from)
+ {
+     using Dispatcher = JSCastingHelpers::InheritsTraits<typename std::remove_cv<typename std::remove_pointer<To>::type>::type>;
+-    if (LIKELY(Dispatcher::template inherits(vm, from)))
++    if (LIKELY(Dispatcher::template inherits<>(vm, from)))
+         return static_cast<To>(from);
+     return nullptr;
+ }