From 502ce644e4a319e99d25602356895831ec16c033 Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Wed, 7 Mar 2018 18:50:50 +0000 Subject: [PATCH 2/7] GCC build fix: mark is_trivially_copy_constructible for WTF::Vector as false. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Compilation in GCC fails because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80654 if T in WTF::Optional> is not trivially copy constructible. The problem already happened in std::vector and was workarounded. This change implements a similar fix for WTF::Vector. Bug: 816952 Change-Id: If87f01beb952e03eb49dcaf0c5db6efd745bf05e Reviewed-on: https://chromium-review.googlesource.com/944404 Commit-Queue: José Dapena Paz Reviewed-by: Kentaro Hara Cr-Commit-Position: refs/heads/master@{#541516} --- third_party/WebKit/Source/platform/wtf/DEPS | 1 + third_party/WebKit/Source/platform/wtf/Vector.h | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/third_party/WebKit/Source/platform/wtf/DEPS b/third_party/WebKit/Source/platform/wtf/DEPS index a2b6603245b4..bccf1e08c77d 100644 --- a/third_party/WebKit/Source/platform/wtf/DEPS +++ b/third_party/WebKit/Source/platform/wtf/DEPS @@ -16,6 +16,7 @@ include_rules = [ "+base/process/process_metrics.h", "+base/rand_util.h", "+base/strings", + "+base/template_util.h", "+base/threading/thread_checker.h", "+base/time/time.h", "+base/tuple.h", diff --git a/third_party/WebKit/Source/platform/wtf/Vector.h b/third_party/WebKit/Source/platform/wtf/Vector.h index c356287b2f42..8421b135e162 100644 --- a/third_party/WebKit/Source/platform/wtf/Vector.h +++ b/third_party/WebKit/Source/platform/wtf/Vector.h @@ -28,6 +28,7 @@ #include #include "base/macros.h" +#include "base/template_util.h" #include "build/build_config.h" #include "platform/wtf/Alignment.h" #include "platform/wtf/ConditionalDestructor.h" @@ -1995,6 +1996,22 @@ Vector::Trace(VisitorDispatcher visitor) { } // namespace WTF +namespace base { + +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 7 +// Workaround for g++7 and earlier family. +// Due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80654, without this +// Optional> where T is non-copyable causes a compile error. +// As we know it is not trivially copy constructible, explicitly declare so. +// +// It completes the declaration in base/template_util.h that was provided +// for std::vector +template +struct is_trivially_copy_constructible> : std::false_type {}; +#endif + +} // namespace base + using WTF::Vector; #endif // WTF_Vector_h -- 2.17.0