aboutsummaryrefslogtreecommitdiffstats
path: root/chromium/chromium/chromium-gcc10-r756880.patch
blob: 1a3bcf6cb3f08bbaf71052eea2895e4a100d6aeb (plain) (blame)
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
From 8d115ddda495d0d2e1e1447392db6e9e6a8a1b32 Mon Sep 17 00:00:00 2001
From: Stephan Hartmann <stha09@googlemail.com>
Date: Tue, 7 Apr 2020 00:23:57 +0000
Subject: [PATCH] GCC: fix template specialization in WTF::VectorMover

GCC complains that explicit specialization in non-namespace scope
is happening for MoveOverlappingImpl. However, secialization is
not really necessary here with templates and can be moved
into MoveOverlappingImpl method without changing generated code.

Bug: 819294
Change-Id: I90b893b9701748302f7b900fbcc2c341685fe0d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2126290
Reviewed-by: Kent Tamura <tkent@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756880}
---
 .../blink/renderer/platform/wtf/vector.h      | 39 ++++++++-----------
 1 file changed, 16 insertions(+), 23 deletions(-)

diff --git a/third_party/blink/renderer/platform/wtf/vector.h b/third_party/blink/renderer/platform/wtf/vector.h
index 632d30883c91..82aaf96cad03 100644
--- a/third_party/blink/renderer/platform/wtf/vector.h
+++ b/third_party/blink/renderer/platform/wtf/vector.h
@@ -205,30 +205,23 @@ struct VectorMover<true, T, Allocator> {
     }
   }
 
-  template <bool = Allocator::kIsGarbageCollected>
-  static void MoveOverlappingImpl(const T* src, const T* src_end, T* dst);
-  template <>
-  static void MoveOverlappingImpl<false>(const T* src,
-                                         const T* src_end,
-                                         T* dst) {
-    memmove(dst, src,
-            reinterpret_cast<const char*>(src_end) -
-                reinterpret_cast<const char*>(src));
-  }
-  template <>
-  static void MoveOverlappingImpl<true>(const T* src,
-                                        const T* src_end,
-                                        T* dst) {
-    if (src == dst)
-      return;
-    if (dst < src) {
-      for (; src < src_end; ++src, ++dst)
-        AtomicWriteMemcpy<sizeof(T)>(dst, src);
+  static void MoveOverlappingImpl(const T* src, const T* src_end, T* dst) {
+    if (Allocator::kIsGarbageCollected) {
+      if (src == dst)
+        return;
+      if (dst < src) {
+        for (; src < src_end; ++src, ++dst)
+          AtomicWriteMemcpy<sizeof(T)>(dst, src);
+      } else {
+        --src_end;
+        T* dst_end = dst + (src_end - src);
+        for (; src_end >= src; --src_end, --dst_end)
+          AtomicWriteMemcpy<sizeof(T)>(dst_end, src_end);
+      }
     } else {
-      --src_end;
-      T* dst_end = dst + (src_end - src);
-      for (; src_end >= src; --src_end, --dst_end)
-        AtomicWriteMemcpy<sizeof(T)>(dst_end, src_end);
+      memmove(dst, src,
+              reinterpret_cast<const char*>(src_end) -
+                  reinterpret_cast<const char*>(src));
     }
   }
 
-- 
2.26.2