Commit 6a154732 authored by tzik's avatar tzik Committed by Commit bot

Remove GTEST_LANG_CXX11 and switch to C++11 on gtest and gmock

This CL removes GTEST_LANG_CXX11=0 from build configuration, and let
gtest detect whether C++11 is available. And to make it work, this CL
injects a custom gmock-port.h to provide missing type_traits.

BUG=630299

Review-Url: https://codereview.chromium.org/2174663002
Cr-Commit-Position: refs/heads/master@{#407360}
parent f968efb3
...@@ -4,7 +4,10 @@ ...@@ -4,7 +4,10 @@
config("gmock_config") { config("gmock_config") {
# Gmock headers need to be able to find themselves. # Gmock headers need to be able to find themselves.
include_dirs = [ "include" ] include_dirs = [
"//testing/gmock_custom",
"include",
]
} }
static_library("gmock") { static_library("gmock") {
......
...@@ -14,9 +14,6 @@ config("gtest_config") { ...@@ -14,9 +14,6 @@ config("gtest_config") {
# In order to allow regex matches in gtest to be shared between Windows # In order to allow regex matches in gtest to be shared between Windows
# and other systems, we tell gtest to always use it's internal engine. # and other systems, we tell gtest to always use it's internal engine.
"GTEST_HAS_POSIX_RE=0", "GTEST_HAS_POSIX_RE=0",
# Chrome doesn't support / require C++11, yet.
"GTEST_LANG_CXX11=0",
] ]
# Gtest headers need to be able to find themselves. # Gtest headers need to be able to find themselves.
......
...@@ -223,9 +223,6 @@ ...@@ -223,9 +223,6 @@
'defines': [ 'defines': [
'VERSION=<(version_full)', 'VERSION=<(version_full)',
], ],
'include_dirs': [
'../testing/gmock/include',
],
'sources': [ 'sources': [
# Note: sources list duplicated in GN build. # Note: sources list duplicated in GN build.
'base/auto_thread_task_runner_unittest.cc', 'base/auto_thread_task_runner_unittest.cc',
...@@ -575,9 +572,6 @@ ...@@ -575,9 +572,6 @@
'defines': [ 'defines': [
'VERSION=<(version_full)', 'VERSION=<(version_full)',
], ],
'include_dirs': [
'../testing/gmock/include',
],
'sources': [ 'sources': [
'base/run_all_unittests.cc', 'base/run_all_unittests.cc',
'test/codec_perftest.cc', 'test/codec_perftest.cc',
......
...@@ -36,11 +36,12 @@ ...@@ -36,11 +36,12 @@
'gmock/src/gmock-all.cc', # Not needed by our build. 'gmock/src/gmock-all.cc', # Not needed by our build.
], ],
'include_dirs': [ 'include_dirs': [
'gmock', 'gmock_custom',
'gmock/include', 'gmock/include',
], ],
'all_dependent_settings': { 'all_dependent_settings': {
'include_dirs': [ 'include_dirs': [
'gmock_custom',
'gmock/include', # So that gmock headers can find themselves. 'gmock/include', # So that gmock headers can find themselves.
], ],
}, },
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef TESTING_GMOCK_CUSTOM_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_
#define TESTING_GMOCK_CUSTOM_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_
#include <type_traits>
namespace std {
// Provide alternative implementation of std::is_default_constructible for
// old, pre-4.7 of libstdc++, where is_default_constructible is missing.
// <20120322 below implies pre-4.7.0. In addition we blacklist several version
// that released after 4.7.0 from pre-4.7.0 branch. 20120702 implies 4.5.4, and
// 20121127 implies 4.6.4.
#if defined(__GLIBCXX__) && \
(__GLIBCXX__ < 20120322 || \
__GLIBCXX__ == 20120702 || \
__GLIBCXX__ == 20121127)
template <typename T>
using is_default_constructible = std::is_constructible<T>;
#endif
}
#endif // TESTING_GMOCK_CUSTOM_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
# In order to allow regex matches in gtest to be shared between Windows # In order to allow regex matches in gtest to be shared between Windows
# and other systems, we tell gtest to always use it's internal engine. # and other systems, we tell gtest to always use it's internal engine.
'GTEST_HAS_POSIX_RE=0', 'GTEST_HAS_POSIX_RE=0',
# Chrome doesn't support / require C++11, yet.
'GTEST_LANG_CXX11=0',
], ],
'all_dependent_settings': { 'all_dependent_settings': {
'include_dirs': [ 'include_dirs': [
...@@ -34,7 +32,6 @@ ...@@ -34,7 +32,6 @@
], ],
'defines': [ 'defines': [
'GTEST_HAS_POSIX_RE=0', 'GTEST_HAS_POSIX_RE=0',
'GTEST_LANG_CXX11=0',
], ],
}, },
'conditions': [ 'conditions': [
......
...@@ -36,20 +36,10 @@ ...@@ -36,20 +36,10 @@
# Windows and other systems, we tell gtest to always use it's # Windows and other systems, we tell gtest to always use it's
# internal engine. # internal engine.
'GTEST_HAS_POSIX_RE=0', 'GTEST_HAS_POSIX_RE=0',
'GTEST_LANG_CXX11=0',
# gtest isn't able to figure out when RTTI is disabled for gcc
# versions older than 4.3.2, and assumes it's enabled. Our Mac
# and Linux builds disable RTTI, and cannot guarantee that the
# compiler will be 4.3.2. or newer. The Mac, for example, uses
# 4.2.1 as that is the latest available on that platform. gtest
# must be instructed that RTTI is disabled here, and for any
# direct dependents that might include gtest headers.
'GTEST_HAS_RTTI=0',
], ],
'all_dependent_settings': { 'all_dependent_settings': {
'defines': [ 'defines': [
'GTEST_HAS_POSIX_RE=0', 'GTEST_HAS_POSIX_RE=0',
'GTEST_LANG_CXX11=0',
], ],
'link_flags': [ 'link_flags': [
'-lgtest_nacl', '-lgtest_nacl',
...@@ -58,7 +48,6 @@ ...@@ -58,7 +48,6 @@
'direct_dependent_settings': { 'direct_dependent_settings': {
'defines': [ 'defines': [
'UNIT_TEST', 'UNIT_TEST',
'GTEST_HAS_RTTI=0',
], ],
'include_dirs': [ 'include_dirs': [
'gtest/include', # So that gtest headers can find themselves. 'gtest/include', # So that gtest headers can find themselves.
......
...@@ -65,9 +65,6 @@ ...@@ -65,9 +65,6 @@
'win/event_utils_win_unittest.cc', 'win/event_utils_win_unittest.cc',
'x/events_x_unittest.cc', 'x/events_x_unittest.cc',
], ],
'include_dirs': [
'../../testing/gmock/include',
],
'conditions': [ 'conditions': [
['use_x11==1', { ['use_x11==1', {
'dependencies': [ 'dependencies': [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment