git: aa9dd586527b - main - java/openjfx14: fix build with clang 19

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Fri, 01 Nov 2024 17:50:28 UTC
The branch main has been updated by dim:

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

commit aa9dd586527b3e2a402b9699c5a7934728a27bfe
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-11-01 13:32:58 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-11-01 17:50:12 +0000

    java/openjfx14: 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/java/openjfx14/work/jfx-14.0.2.1-1/modules/javafx.web/src/main/native/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h:923:65: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
        923 |         AssemblerType::repatchCompact(dataLabelCompact.template dataLocation(), value);
            |                                                                 ^
      /wrkdirs/usr/ports/java/openjfx14/work/jfx-14.0.2.1-1/modules/javafx.web/src/main/native/Source/JavaScriptCore/runtime/JSCast.h:146:33: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
        146 |     return Dispatcher::template inherits(vm, from);
            |                                 ^
      /wrkdirs/usr/ports/java/openjfx14/work/jfx-14.0.2.1-1/modules/javafx.web/src/main/native/Source/JavaScriptCore/runtime/JSCast.h:155:37: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
        155 |     if (LIKELY(Dispatcher::template inherits(vm, from)))
            |                                     ^
      /wrkdirs/usr/ports/java/openjfx14/work/jfx-14.0.2.1-1/modules/javafx.web/src/main/native/Source/JavaScriptCore/llint/LLIntData.h:159:75: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
        159 |     return reinterpret_cast<LLIntCode>(getCodePtr<tag>(opcodeID).template executableAddress());
            |                                                                           ^
    
    In all these cases, appending "<>" is enough to satisfy the constraint.
    
    [1] https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#96
    
    PR:             282473
    MFH:            2024Q4
---
 ...JavaScriptCore_assembler_AbstractMacroAssembler.h | 11 +++++++++++
 ...in_native_Source_JavaScriptCore_llint_LLIntData.h | 11 +++++++++++
 ...ain_native_Source_JavaScriptCore_runtime_JSCast.h | 20 ++++++++++++++++++++
 3 files changed, 42 insertions(+)

diff --git a/java/openjfx14/files/patch-modules_javafx.web_src_main_native_Source_JavaScriptCore_assembler_AbstractMacroAssembler.h b/java/openjfx14/files/patch-modules_javafx.web_src_main_native_Source_JavaScriptCore_assembler_AbstractMacroAssembler.h
new file mode 100644
index 000000000000..35531d5d1c29
--- /dev/null
+++ b/java/openjfx14/files/patch-modules_javafx.web_src_main_native_Source_JavaScriptCore_assembler_AbstractMacroAssembler.h
@@ -0,0 +1,11 @@
+--- modules/javafx.web/src/main/native/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h.orig	2020-07-17 10:21:33 UTC
++++ modules/javafx.web/src/main/native/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h
+@@ -920,7 +920,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/java/openjfx14/files/patch-modules_javafx.web_src_main_native_Source_JavaScriptCore_llint_LLIntData.h b/java/openjfx14/files/patch-modules_javafx.web_src_main_native_Source_JavaScriptCore_llint_LLIntData.h
new file mode 100644
index 000000000000..abe9b2a15115
--- /dev/null
+++ b/java/openjfx14/files/patch-modules_javafx.web_src_main_native_Source_JavaScriptCore_llint_LLIntData.h
@@ -0,0 +1,11 @@
+--- modules/javafx.web/src/main/native/Source/JavaScriptCore/llint/LLIntData.h.orig	2020-07-17 10:21:33 UTC
++++ modules/javafx.web/src/main/native/Source/JavaScriptCore/llint/LLIntData.h
+@@ -156,7 +156,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
+ }
+ 
diff --git a/java/openjfx14/files/patch-modules_javafx.web_src_main_native_Source_JavaScriptCore_runtime_JSCast.h b/java/openjfx14/files/patch-modules_javafx.web_src_main_native_Source_JavaScriptCore_runtime_JSCast.h
new file mode 100644
index 000000000000..72024f106975
--- /dev/null
+++ b/java/openjfx14/files/patch-modules_javafx.web_src_main_native_Source_JavaScriptCore_runtime_JSCast.h
@@ -0,0 +1,20 @@
+--- modules/javafx.web/src/main/native/Source/JavaScriptCore/runtime/JSCast.h.orig	2020-07-17 10:21:33 UTC
++++ modules/javafx.web/src/main/native/Source/JavaScriptCore/runtime/JSCast.h
+@@ -143,7 +143,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
+@@ -152,7 +152,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;
+ }