From: Khem Raj Date: Wed, 19 Mar 2025 08:15:30 +0000 (-0700) Subject: webkitgtk: Fix build with clang-20 X-Git-Tag: yocto-5.2~150 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fb4d29e17230080d727de1107cc48bdc4c169302;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git webkitgtk: Fix build with clang-20 Backport the proposed patch to sync Enum traits header Signed-off-by: Khem Raj Signed-off-by: Richard Purdie --- diff --git a/meta/recipes-sato/webkit/webkitgtk/0001-EnumTraits.h-error-no-matching-function-for-call-to-.patch b/meta/recipes-sato/webkit/webkitgtk/0001-EnumTraits.h-error-no-matching-function-for-call-to-.patch new file mode 100644 index 00000000000..5b83d9e7eb2 --- /dev/null +++ b/meta/recipes-sato/webkit/webkitgtk/0001-EnumTraits.h-error-no-matching-function-for-call-to-.patch @@ -0,0 +1,77 @@ +From 7d159a631ae55c10a0b7a92cf031200a11629736 Mon Sep 17 00:00:00 2001 +From: Fujii Hironori +Date: Tue, 18 Mar 2025 10:25:47 +0900 +Subject: [PATCH] EnumTraits.h: error: no matching function for call to + 'enumName' with Clang 20 https://bugs.webkit.org/show_bug.cgi?id=289669 + +Reviewed by NOBODY (OOPS!). + +Clang 20 couldn't compile EnumTraits.h. + +> wtf/EnumTraits.h:212:33: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'V' + +An invalid enum value can't be specifed to the template parameter `V`. + +> template constexpr std::span enumName() + +The upstream Magic Enum C++ has a template variable `is_enum_constexpr_static_cast_valid` to check a enum value is valid. + + +Imported the template variable. + +* Source/WTF/wtf/EnumTraits.h: +(WTF::enumName): +(WTF::makeEnumNames): + +Upstream-Status: Submitted [https://github.com/WebKit/WebKit/pull/42597] +Signed-off-by: Khem Raj +--- + Source/WTF/wtf/EnumTraits.h | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +diff --git a/Source/WTF/wtf/EnumTraits.h b/Source/WTF/wtf/EnumTraits.h +index 0d33e39a..95e6318b 100644 +--- a/Source/WTF/wtf/EnumTraits.h ++++ b/Source/WTF/wtf/EnumTraits.h +@@ -152,6 +152,16 @@ constexpr bool isZeroBasedContiguousEnum() + #pragma clang diagnostic ignored "-Wenum-constexpr-conversion" + #endif + ++#if COMPILER(CLANG) && __clang_major__ >= 16 ++template ++inline constexpr bool isEnumConstexprStaticCastValid = false; ++template ++inline constexpr bool isEnumConstexprStaticCastValid(V)>>> = true; ++#else ++template ++inline constexpr bool isEnumConstexprStaticCastValid = true; ++#endif ++ + template + constexpr std::span enumTypeNameImpl() + { +@@ -215,6 +225,15 @@ constexpr std::span enumName() + return result; + } + ++template ++constexpr std::span enumName() ++{ ++ if constexpr (isEnumConstexprStaticCastValid) ++ return enumName(V)>(); ++ else ++ return { }; ++} ++ + template + constexpr std::underlying_type_t enumNamesMin() + { +@@ -264,7 +283,7 @@ constexpr auto makeEnumNames(std::index_sequence) + { + constexpr auto min = enumNamesMin(); + return std::array, sizeof...(Is)> { +- enumName(static_cast>(Is) + min)>()... ++ enumName>(Is) + min>()... + }; + } + diff --git a/meta/recipes-sato/webkit/webkitgtk_2.48.0.bb b/meta/recipes-sato/webkit/webkitgtk_2.48.0.bb index cb4e09662f7..afd5dcdd8d8 100644 --- a/meta/recipes-sato/webkit/webkitgtk_2.48.0.bb +++ b/meta/recipes-sato/webkit/webkitgtk_2.48.0.bb @@ -16,6 +16,7 @@ SRC_URI = "https://www.webkitgtk.org/releases/${BPN}-${PV}.tar.xz \ file://no-musttail-arm.patch \ file://t6-not-declared.patch \ file://sys_futex.patch \ + file://0001-EnumTraits.h-error-no-matching-function-for-call-to-.patch \ " SRC_URI[sha256sum] = "94904a55cf12d44a4e36ceadafff02d46da73d76be9b4769f34cbfdf0eebf88e"