opt/qt6-webengine/libcxx17.patch

84 lines
2.5 KiB
Diff

Patch status: fixed in >=chromium-116.0.5809.0
Backport of [2][3] in order to fix building with libcxx-17
(and hopefully runtime if upgrade from 16->17 without rebuilding).
In order to apply cleanly, also needed [4] which seems fine to have.
[1] https://crbug.com/1449299
[2] https://crrev.com/9bfbbffdba73668fdb483e5a850911d2b64c35d7
[3] https://crrev.com/4878976cd7391fbc02f87af4b7fb539b5c1f3817
[4] https://crrev.com/5b5551edd3961481e617e510276b9f015a35b861
--- a/src/3rdparty/chromium/base/containers/checked_iterators.h
+++ b/src/3rdparty/chromium/base/containers/checked_iterators.h
@@ -24,4 +24,7 @@
using reference = T&;
using iterator_category = std::random_access_iterator_tag;
+#if defined(__cpp_lib_ranges)
+ using iterator_concept = std::contiguous_iterator_tag;
+#endif
// Required for converting constructor below.
@@ -31,8 +34,6 @@
// Required for certain libc++ algorithm optimizations that are not available
// for NaCl.
-#if defined(_LIBCPP_VERSION) && !BUILDFLAG(IS_NACL)
template <typename Ptr>
friend struct std::pointer_traits;
-#endif
constexpr CheckedContiguousIterator() = default;
@@ -147,4 +148,10 @@
}
+ constexpr friend CheckedContiguousIterator operator+(
+ difference_type lhs,
+ const CheckedContiguousIterator& rhs) {
+ return rhs + lhs;
+ }
+
constexpr CheckedContiguousIterator& operator-=(difference_type rhs) {
if (rhs < 0) {
@@ -218,5 +225,4 @@
} // namespace base
-#if defined(_LIBCPP_VERSION) && !BUILDFLAG(IS_NACL)
// Specialize both std::__is_cpp17_contiguous_iterator and std::pointer_traits
// for CCI in case we compile with libc++ outside of NaCl. The former is
@@ -236,11 +242,28 @@
// [2] https://wg21.link/std.iterator.tags
// [3] https://wg21.link/pointer.traits.optmem
-namespace std {
+
+#if defined(_LIBCPP_VERSION)
+
+_LIBCPP_BEGIN_NAMESPACE_STD
template <typename T>
+struct __is_cpp17_contiguous_iterator;
+template <typename T>
struct __is_cpp17_contiguous_iterator<::base::CheckedContiguousIterator<T>>
: true_type {};
template <typename T>
+struct __libcpp_is_contiguous_iterator;
+template <typename T>
+struct __libcpp_is_contiguous_iterator<::base::CheckedContiguousIterator<T>>
+ : true_type {};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif
+
+namespace std {
+
+template <typename T>
struct pointer_traits<::base::CheckedContiguousIterator<T>> {
using pointer = ::base::CheckedContiguousIterator<T>;
@@ -261,5 +284,4 @@
} // namespace std
-#endif
#endif // BASE_CONTAINERS_CHECKED_ITERATORS_H_