git: 2c14b6e0b4af - main - www/qt6-webengine: fix build with clang and libc++ 19

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sat, 14 Sep 2024 07:23:25 UTC
The branch main has been updated by dim:

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

commit 2c14b6e0b4af03bff9cefe5a9288d6b7450755d8
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-09-13 07:34:56 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-09-14 07:22:49 +0000

    www/qt6-webengine: fix build with clang and libc++ 19
    
    Clang 19 now implements CWG 96 [1], which requires a template
    argument list after a 'template' keyword, resulting in errors similar
    to:
    
      ../../../../../qtwebengine-everywhere-src-6.7.2/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:331:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
        331 |     Base::template Trace([](typename Base::TraceContext ctx) { ctx.Flush(); });
            |                    ^
      ../../../../../qtwebengine-everywhere-src-6.7.2/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:337:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
        337 |     Base::template CallIfEnabled(
            |                    ^
      ../../../../../qtwebengine-everywhere-src-6.7.2/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:352:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
        352 |     Base::template Trace([&](typename Base::TraceContext ctx) {
            |                    ^
      ../../../../../qtwebengine-everywhere-src-6.7.2/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:499:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
        499 |     Base::template Trace([&](typename Base::TraceContext ctx) {
            |                    ^
      ../../../../../qtwebengine-everywhere-src-6.7.2/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:1050:22: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
       1050 |       Base::template TraceWithInstances(instances, std::move(lambda));
            |                      ^
      ../../../../../qtwebengine-everywhere-src-6.7.2/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:1064:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
       1064 |     Base::template Trace([&](typename Base::TraceContext ctx) {
            |                    ^
    
    For perfetto, this was fixed by upstream commit e2f661907a [1].
    
    Another typo is in the third-party quiche library, resulting in:
    
      ../../../../../qtwebengine-everywhere-src-6.7.2/src/3rdparty/chromium/net/third_party/quiche/src/quiche/quic/core/quic_interval_deque.h:201:48: error: no member named 'size' in 'QuicIntervalDeque<T, C>'; did you mean 'Size'?
        201 |       QUICHE_DCHECK(copy.index_ < copy.deque_->size());
            |                                                ^~~~
            |                                                Size
      ../../../../../qtwebengine-everywhere-src-6.7.2/src/3rdparty/chromium/net/third_party/quiche/src/quiche/common/platform/api/quiche_logging.h:48:53: note: expanded from macro 'QUICHE_DCHECK'
         48 | #define QUICHE_DCHECK(condition) QUICHE_DCHECK_IMPL(condition)
            |                                                     ^
      ../../../../../qtwebengine-everywhere-src-6.7.2/src/3rdparty/chromium/net/third_party/quiche/overrides/quiche_platform_impl/quiche_logging_impl.h:89:46: note: expanded from macro 'QUICHE_DCHECK_IMPL'
         89 | #define QUICHE_DCHECK_IMPL(condition) DCHECK(condition)
            |                                              ^
      ../../../../../qtwebengine-everywhere-src-6.7.2/src/3rdparty/chromium/base/check.h:237:53: note: expanded from macro 'DCHECK'
        237 | #define DCHECK(condition) EAT_CHECK_STREAM_PARAMS(!(condition))
            |                                                     ^
      ../../../../../qtwebengine-everywhere-src-6.7.2/src/3rdparty/chromium/base/check.h:58:35: note: expanded from macro 'EAT_CHECK_STREAM_PARAMS'
         58 |        : ::logging::VoidifyStream(expr) & (*::logging::g_swallow_stream)
            |                                   ^
      ../../../../../qtwebengine-everywhere-src-6.7.2/src/3rdparty/chromium/net/third_party/quiche/src/quiche/quic/core/quic_interval_deque.h:241:15: note: 'Size' declared here
        241 |   std::size_t Size() const;
            |               ^
    
    And finally there is a typo in chromium:
    
      ../../../../../qtwebengine-everywhere-src-6.7.2/src/3rdparty/chromium/base/containers/id_map.h:181:19: error: no member named 'map' in 'Iterator<ReturnType>'; did you mean 'map_'?
        181 |       map_ = iter.map;
            |                   ^~~
            |                   map_
      ../../../../../qtwebengine-everywhere-src-6.7.2/src/3rdparty/chromium/base/containers/id_map.h:239:26: note: 'map_' declared here
        239 |     raw_ptr<IDMap<V, K>> map_;
            |                          ^
      ../../../../../qtwebengine-everywhere-src-6.7.2/src/3rdparty/chromium/base/containers/id_map.h:182:20: error: no member named 'iter' in 'Iterator<ReturnType>'; did you mean 'iter_'?
        182 |       iter_ = iter.iter;
            |                    ^~~~
            |                    iter_
      ../../../../../qtwebengine-everywhere-src-6.7.2/src/3rdparty/chromium/base/containers/id_map.h:240:40: note: 'iter_' declared here
        240 |     typename HashTable::const_iterator iter_;
            |                                        ^
    
    [1] https://android.googlesource.com/platform/external/perfetto/+/e2f661907a
    
    PR:             281474
    Approved by:    jhale (maintainer)
---
 ...src_3rdparty_chromium_base_containers_id__map.h | 13 +++++
 ...he_src_quiche_quic_core_quic__interval__deque.h | 17 +++++++
 ...party_blink_renderer_platform_wtf_hash__table.h | 31 ++++++++++++
 ...o_tracing_internal_track__event__data__source.h | 55 ++++++++++++++++++++++
 4 files changed, 116 insertions(+)

diff --git a/www/qt6-webengine/files/patch-src_3rdparty_chromium_base_containers_id__map.h b/www/qt6-webengine/files/patch-src_3rdparty_chromium_base_containers_id__map.h
new file mode 100644
index 000000000000..6d81906f06b8
--- /dev/null
+++ b/www/qt6-webengine/files/patch-src_3rdparty_chromium_base_containers_id__map.h
@@ -0,0 +1,13 @@
+--- src/3rdparty/chromium/base/containers/id_map.h.orig	2024-06-10 11:34:19 UTC
++++ src/3rdparty/chromium/base/containers/id_map.h
+@@ -178,8 +178,8 @@ class IDMap final {
+     }
+ 
+     const Iterator& operator=(const Iterator& iter) {
+-      map_ = iter.map;
+-      iter_ = iter.iter;
++      map_ = iter.map_;
++      iter_ = iter.iter_;
+       Init();
+       return *this;
+     }
diff --git a/www/qt6-webengine/files/patch-src_3rdparty_chromium_net_third__party_quiche_src_quiche_quic_core_quic__interval__deque.h b/www/qt6-webengine/files/patch-src_3rdparty_chromium_net_third__party_quiche_src_quiche_quic_core_quic__interval__deque.h
new file mode 100644
index 000000000000..fb5cfb95ade4
--- /dev/null
+++ b/www/qt6-webengine/files/patch-src_3rdparty_chromium_net_third__party_quiche_src_quiche_quic_core_quic__interval__deque.h
@@ -0,0 +1,17 @@
+--- src/3rdparty/chromium/net/third_party/quiche/src/quiche/quic/core/quic_interval_deque.h.orig	2024-06-10 11:34:19 UTC
++++ src/3rdparty/chromium/net/third_party/quiche/src/quiche/quic/core/quic_interval_deque.h
+@@ -198,12 +198,12 @@ class QUIC_NO_EXPORT QuicIntervalDeque {
+     Iterator operator+(difference_type amount) const {
+       Iterator copy = *this;
+       copy.index_ += amount;
+-      QUICHE_DCHECK(copy.index_ < copy.deque_->size());
++      QUICHE_DCHECK(copy.index_ < copy.deque_->Size());
+       return copy;
+     }
+     Iterator& operator+=(difference_type amount) {
+       index_ += amount;
+-      QUICHE_DCHECK(index_ < deque_->size());
++      QUICHE_DCHECK(index_ < deque_->Size());
+       return *this;
+     }
+     difference_type operator-(const Iterator& rhs) const {
diff --git a/www/qt6-webengine/files/patch-src_3rdparty_chromium_third__party_blink_renderer_platform_wtf_hash__table.h b/www/qt6-webengine/files/patch-src_3rdparty_chromium_third__party_blink_renderer_platform_wtf_hash__table.h
new file mode 100644
index 000000000000..85db2a3579b7
--- /dev/null
+++ b/www/qt6-webengine/files/patch-src_3rdparty_chromium_third__party_blink_renderer_platform_wtf_hash__table.h
@@ -0,0 +1,31 @@
+--- src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h.orig	2024-06-10 11:34:19 UTC
++++ src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h
+@@ -1646,7 +1646,7 @@ HashTable<Key, Value, Extractor, Traits, KeyTraits, Al
+     }
+   }
+   table_ = temporary_table;
+-  Allocator::template BackingWriteBarrier(&table_);
++  Allocator::template BackingWriteBarrier<>(&table_);
+ 
+   HashTableBucketInitializer<Traits, Allocator, Value>::InitializeTable(
+       original_table, new_table_size);
+@@ -1700,7 +1700,7 @@ Value* HashTable<Key, Value, Extractor, Traits, KeyTra
+   // This swaps the newly allocated buffer with the current one. The store to
+   // the current table has to be atomic to prevent races with concurrent marker.
+   AsAtomicPtr(&table_)->store(new_hash_table.table_, std::memory_order_relaxed);
+-  Allocator::template BackingWriteBarrier(&table_);
++  Allocator::template BackingWriteBarrier<>(&table_);
+   table_size_ = new_table_size;
+ 
+   new_hash_table.table_ = old_table;
+@@ -1852,8 +1852,8 @@ void HashTable<Key, Value, Extractor, Traits, KeyTrait
+   // on the mutator thread, which is also the only one that writes to them, so
+   // there is *no* risk of data races when reading.
+   AtomicWriteSwap(table_, other.table_);
+-  Allocator::template BackingWriteBarrier(&table_);
+-  Allocator::template BackingWriteBarrier(&other.table_);
++  Allocator::template BackingWriteBarrier<>(&table_);
++  Allocator::template BackingWriteBarrier<>(&other.table_);
+   if (IsWeak<ValueType>::value) {
+     // Weak processing is omitted when no backing store is present. In case such
+     // an empty table is later on used it needs to be strongified.
diff --git a/www/qt6-webengine/files/patch-src_3rdparty_chromium_third__party_perfetto_include_perfetto_tracing_internal_track__event__data__source.h b/www/qt6-webengine/files/patch-src_3rdparty_chromium_third__party_perfetto_include_perfetto_tracing_internal_track__event__data__source.h
new file mode 100644
index 000000000000..742c873632b9
--- /dev/null
+++ b/www/qt6-webengine/files/patch-src_3rdparty_chromium_third__party_perfetto_include_perfetto_tracing_internal_track__event__data__source.h
@@ -0,0 +1,55 @@
+--- src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h.orig	2024-06-10 11:34:19 UTC
++++ src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h
+@@ -328,14 +328,13 @@ class TrackEventDataSource
+   }
+ 
+   static void Flush() {
+-    Base::template Trace([](typename Base::TraceContext ctx) { ctx.Flush(); });
++    Base::Trace([](typename Base::TraceContext ctx) { ctx.Flush(); });
+   }
+ 
+   // Determine if *any* tracing category is enabled.
+   static bool IsEnabled() {
+     bool enabled = false;
+-    Base::template CallIfEnabled(
+-        [&](uint32_t /*instances*/) { enabled = true; });
++    Base::CallIfEnabled([&](uint32_t /*instances*/) { enabled = true; });
+     return enabled;
+   }
+ 
+@@ -349,7 +348,7 @@ class TrackEventDataSource
+   static bool IsDynamicCategoryEnabled(
+       const DynamicCategory& dynamic_category) {
+     bool enabled = false;
+-    Base::template Trace([&](typename Base::TraceContext ctx) {
++    Base::Trace([&](typename Base::TraceContext ctx) {
+       enabled = enabled || IsDynamicCategoryEnabled(&ctx, dynamic_category);
+     });
+     return enabled;
+@@ -496,7 +495,7 @@ class TrackEventDataSource
+                                  const protos::gen::TrackDescriptor& desc) {
+     PERFETTO_DCHECK(track.uuid == desc.uuid());
+     TrackRegistry::Get()->UpdateTrack(track, desc.SerializeAsString());
+-    Base::template Trace([&](typename Base::TraceContext ctx) {
++    Base::Trace([&](typename Base::TraceContext ctx) {
+       TrackEventInternal::WriteTrackDescriptor(
+           track, ctx.tls_inst_->trace_writer.get(), ctx.GetIncrementalState(),
+           *ctx.GetCustomTlsState(), TrackEventInternal::GetTraceTime());
+@@ -1047,7 +1046,7 @@ class TrackEventDataSource
+                                  Lambda lambda) PERFETTO_ALWAYS_INLINE {
+     using CatTraits = CategoryTraits<CategoryType>;
+     if (CatTraits::kIsDynamic) {
+-      Base::template TraceWithInstances(instances, std::move(lambda));
++      Base::TraceWithInstances(instances, std::move(lambda));
+     } else {
+       Base::template TraceWithInstances<CategoryTracePointTraits>(
+           instances, std::move(lambda), {CatTraits::GetStaticIndex(category)});
+@@ -1061,7 +1060,7 @@ class TrackEventDataSource
+       const TrackType& track,
+       std::function<void(protos::pbzero::TrackDescriptor*)> callback) {
+     TrackRegistry::Get()->UpdateTrack(track, std::move(callback));
+-    Base::template Trace([&](typename Base::TraceContext ctx) {
++    Base::Trace([&](typename Base::TraceContext ctx) {
+       TrackEventInternal::WriteTrackDescriptor(
+           track, ctx.tls_inst_->trace_writer.get(), ctx.GetIncrementalState(),
+           *ctx.GetCustomTlsState(), TrackEventInternal::GetTraceTime());