git: a6ea23b32706 - main - www/qt5-webengine: fix build with clang/libc++ 15

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Fri, 06 Jan 2023 18:05:00 UTC
The branch main has been updated by dim (src committer):

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

commit a6ea23b32706da00c72f645cc57c7e26ce419668
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-01-06 11:42:21 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-01-06 18:03:41 +0000

    www/qt5-webengine: fix build with clang/libc++ 15
    
    During an exp-run for llvm 15 (see bug 265425), it turned out that
    www/qt5-webengine failed to build with clang and libc++ 15:
    
      In file included from ../../../../qtwebengine-everywhere-src-5.15.2/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/trace_sorter.cc:17:
      In file included from /usr/include/c++/v1/algorithm:1712:
      In file included from /usr/include/c++/v1/memory:842:
      In file included from /usr/include/c++/v1/__algorithm/move.h:12:
      /usr/include/c++/v1/__algorithm/iterator_operations.h:100:5: error: static assertion failed due to requirement 'is_same<perfetto::trace_processor::TimestampedTracePiece &, const perfetto::trace_processor::TimestampedTracePiece &>::value': It looks like your iterator's `iterator_traits<It>::reference` does not match the return type of dereferencing the iterator, i.e., calling `*it`. This is undefined behavior according to [input.iterators] and can lead to dangling reference issues at runtime, so we are flagging this.
          static_assert(is_same<__deref_t<_Iter>, typename iterator_traits<__uncvref_t<_Iter> >::reference>::value,
          ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /usr/include/c++/v1/__algorithm/iterator_operations.h:115:5: note: in instantiation of function template specialization 'std::_IterOps<std::_ClassicAlgPolicy>::__validate_iter_reference<perfetto::base::CircularQueue<perfetto::trace_processor::TimestampedTracePiece>::Iterator &>' requested here
          __validate_iter_reference<_Iter>();
          ^
      /usr/include/c++/v1/__algorithm/sift_down.h:55:28: note: in instantiation of function template specialization 'std::_IterOps<std::_ClassicAlgPolicy>::__iter_move<perfetto::base::CircularQueue<perfetto::trace_processor::TimestampedTracePiece>::Iterator &>' requested here
          value_type __top(_Ops::__iter_move(__start));
                                 ^
      /usr/include/c++/v1/__algorithm/make_heap.h:37:14: note: in instantiation of function template specialization 'std::__sift_down<std::_ClassicAlgPolicy, std::__less<perfetto::trace_processor::TimestampedTracePiece> &, perfetto::base::CircularQueue<perfetto::trace_processor::TimestampedTracePiece>::Iterator>' requested here
              std::__sift_down<_AlgPolicy>(__first, __comp_ref, __n, __first + __start);
                   ^
      /usr/include/c++/v1/__algorithm/partial_sort.h:39:8: note: in instantiation of function template specialization 'std::__make_heap<std::_ClassicAlgPolicy, std::__less<perfetto::trace_processor::TimestampedTracePiece> &, perfetto::base::CircularQueue<perfetto::trace_processor::TimestampedTracePiece>::Iterator>' requested here
        std::__make_heap<_AlgPolicy>(__first, __middle, __comp);
             ^
      /usr/include/c++/v1/__algorithm/partial_sort.h:67:27: note: in instantiation of function template specialization 'std::__partial_sort_impl<std::_ClassicAlgPolicy, std::__less<perfetto::trace_processor::TimestampedTracePiece> &, perfetto::base::CircularQueue<perfetto::trace_processor::TimestampedTracePiece>::Iterator, perfetto::base::CircularQueue<perfetto::trace_processor::TimestampedTracePiece>::Iterator>' requested here
        auto __last_iter = std::__partial_sort_impl<_AlgPolicy>(__first, __middle, __last, static_cast<_Comp_ref>(__comp));
                                ^
      /usr/include/c++/v1/__algorithm/sort.h:681:10: note: in instantiation of function template specialization 'std::__partial_sort<std::_ClassicAlgPolicy, std::__less<perfetto::trace_processor::TimestampedTracePiece>, perfetto::base::CircularQueue<perfetto::trace_processor::TimestampedTracePiece>::Iterator, perfetto::base::CircularQueue<perfetto::trace_processor::TimestampedTracePiece>::Iterator>' requested here
          std::__partial_sort<_AlgPolicy>(__first, __last, __last, __comp);
               ^
      /usr/include/c++/v1/__algorithm/sort.h:694:8: note: in instantiation of function template specialization 'std::__sort_impl<std::_ClassicAlgPolicy, perfetto::base::CircularQueue<perfetto::trace_processor::TimestampedTracePiece>::Iterator, std::__less<perfetto::trace_processor::TimestampedTracePiece>>' requested here
        std::__sort_impl<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __comp);
             ^
      /usr/include/c++/v1/__algorithm/sort.h:700:8: note: in instantiation of function template specialization 'std::sort<perfetto::base::CircularQueue<perfetto::trace_processor::TimestampedTracePiece>::Iterator, std::__less<perfetto::trace_processor::TimestampedTracePiece>>' requested here
        std::sort(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>());
             ^
      ../../../../qtwebengine-everywhere-src-5.15.2/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/trace_sorter.cc:51:8: note: in instantiation of function template specialization 'std::sort<perfetto::base::CircularQueue<perfetto::trace_processor::TimestampedTracePiece>::Iterator>' requested here
        std::sort(sort_begin, events_.end());
             ^
    
    This turns out to be a problem with the iterator type in perfetto's
    CircularQueue class: its pointer and reference types are const, while
    they should not be. Upstream fixed this in
    https://github.com/google/perfetto/commit/c81e804f8, so apply a
    minimalistic version of it.
    
    PR:             268784
    Approved by:    tcberner (maintainer)
    MFH:            2023Q1
---
 ...tto_include_perfetto_ext_base_circular__queue.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/www/qt5-webengine/files/patch-src_3rdparty_chromium_third__party_perfetto_include_perfetto_ext_base_circular__queue.h b/www/qt5-webengine/files/patch-src_3rdparty_chromium_third__party_perfetto_include_perfetto_ext_base_circular__queue.h
new file mode 100644
index 000000000000..140d969a385f
--- /dev/null
+++ b/www/qt5-webengine/files/patch-src_3rdparty_chromium_third__party_perfetto_include_perfetto_ext_base_circular__queue.h
@@ -0,0 +1,22 @@
+commit c81e804f8d37823aac9cf9d6d4ca92363284bf3b
+Author: Lalit Maganti <lalitm@google.com>
+Date:   Tue Apr 7 21:13:02 2020 +0100
+
+    base: attempt to fix compile on vs2019
+    
+    Bug: 153189621
+    Change-Id: Ie93cd0d6e4e128c5402539dac15507d4aed22edd
+
+--- src/3rdparty/chromium/third_party/perfetto/include/perfetto/ext/base/circular_queue.h.orig	2020-11-07 01:22:36 UTC
++++ src/3rdparty/chromium/third_party/perfetto/include/perfetto/ext/base/circular_queue.h
+@@ -52,8 +52,8 @@ class CircularQueue {
+    public:
+     using difference_type = ptrdiff_t;
+     using value_type = T;
+-    using pointer = const T*;
+-    using reference = const T&;
++    using pointer = T*;
++    using reference = T&;
+     using iterator_category = std::random_access_iterator_tag;
+ 
+     Iterator(CircularQueue* queue, uint64_t pos, uint32_t generation)