HomeFreeBSD

www/qt5-webengine: fix build with clang and libc++ 19

Description

www/qt5-webengine: fix build with clang and libc++ 19

As noted in the libc++ 19 release notes [1], std::char_traits<> is now
only provided for char, char8_t, char16_t, char32_t and wchar_t, and any
instantiation for other types will fail.

This causes www/qt5-webengine to fail to compile with clang 19 and
libc++ 19, resulting in errors similar to:

/usr/include/c++/v1/string:820:42: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>'
  820 |   static_assert(is_same<_CharT, typename traits_type::char_type>::value,
      |                                          ^
../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/v8/src/inspector/v8-string-conversions.cc:390:26: note: in instantiation of template class 'std::basic_string<unsigned short>' requested here
  390 | std::basic_string<UChar> UTF8ToUTF16(const char* stringStart, size_t length) {
      |                          ^
/usr/include/c++/v1/__fwd/string.h:23:29: note: template is declared here
   23 | struct _LIBCPP_TEMPLATE_VIS char_traits;
      |                             ^

Upstream v8 has fixed this in commit 182d9c05e78 [2], so add it as a
backported patch, until the next version of qt5-webengine is released.

Also, clang 19 now implements CWG 96 [1], which requires a template
argument list after a 'template' keyword, resulting in errors similar
to:

../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h:1789:23: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
 1789 |   Allocator::template BackingWriteBarrier(&table_);
      |                       ^
../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h:1847:23: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
 1847 |   Allocator::template BackingWriteBarrier(&table_);
      |                       ^
../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h:2015:23: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
 2015 |   Allocator::template BackingWriteBarrier(&table_);
      |                       ^
../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h:2016:23: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
 2016 |   Allocator::template BackingWriteBarrier(&other.table_);
      |                       ^

and:

../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:110:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  110 |     Base::template Trace([](typename Base::TraceContext ctx) { ctx.Flush(); });
      |                    ^
../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:124:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  124 |     Base::template Trace([&](typename Base::TraceContext ctx) {
      |                    ^
../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:431:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  431 |     Base::template Trace([&](typename Base::TraceContext ctx) {
      |                    ^
../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:548:22: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  548 |       Base::template TraceWithInstances(instances, std::move(lambda));
      |                      ^
../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:563:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  563 |     Base::template Trace([&](typename Base::TraceContext ctx) {
      |                    ^

In case of wtf, appending "<>" is enough to satisfy the constraint. For
perfetto, this was fixed by upstream commit e2f661907a [3].

[1] https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals
[2] https://chromium.googlesource.com/v8/v8.git/+/182d9c05e78
[3] https://android.googlesource.com/platform/external/perfetto/+/e2f661907a

PR: 281431
Approved by: jhale (maintainer)
MFH: 2024Q3

Details

Provenance
dimAuthored on Sep 11 2024, 7:12 AM
Parents
R11:a2b5a55c6ae2: net-mgmt/p5-OSLV-Monitor: Add missing dependency
Branches
Unknown
Tags
Unknown