summaryrefslogtreecommitdiff
path: root/dev-qt/qtwebengine/files/qtwebengine-6.5.2-libcxx17.patch
blob: 8acbbf4463ceb343d0c907d9209c99bcbfa53edb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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_