[Bug 268784] www/qt5-webengine: fix build with clang/libc++ 15

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 06 Jan 2023 13:17:23 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268784

            Bug ID: 268784
           Summary: www/qt5-webengine: fix build with clang/libc++ 15
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: kde@FreeBSD.org
          Reporter: dim@FreeBSD.org
          Assignee: kde@FreeBSD.org
             Flags: maintainer-feedback?(kde@FreeBSD.org)

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.