summaryrefslogtreecommitdiffstats
path: root/googlemock
diff options
context:
space:
mode:
authorMark Mentovai <mark@chromium.org>2015-10-12 21:57:51 (GMT)
committerMark Mentovai <mark@chromium.org>2015-10-12 21:59:11 (GMT)
commita0435dc6879c336ab29afd64c380995055d2cd53 (patch)
tree1c60ad95e95b30ee7d7f85c63666e01e17d93af8 /googlemock
parent7f4448f40b3f3f16a75787c016139511579367ed (diff)
downloadgoogletest-a0435dc6879c336ab29afd64c380995055d2cd53.zip
googletest-a0435dc6879c336ab29afd64c380995055d2cd53.tar.gz
googletest-a0435dc6879c336ab29afd64c380995055d2cd53.tar.bz2
googlemock: Support C++11 language with pre-C++11 libraryrefs/pull/611/head
This guards use of <type_traits> and its features with GTEST_HAS_STD_TYPE_TRAITS_, and std::function with GTEST_HAS_STD_FUNCTION_.
Diffstat (limited to 'googlemock')
-rw-r--r--googlemock/include/gmock/gmock-actions.h8
-rw-r--r--googlemock/test/gmock-actions_test.cc4
-rw-r--r--googlemock/test/gmock-matchers_test.cc8
3 files changed, 10 insertions, 10 deletions
diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h
index c09c4d6..b3f654a 100644
--- a/googlemock/include/gmock/gmock-actions.h
+++ b/googlemock/include/gmock/gmock-actions.h
@@ -46,7 +46,7 @@
#include "gmock/internal/gmock-internal-utils.h"
#include "gmock/internal/gmock-port.h"
-#if GTEST_LANG_CXX11 // Defined by gtest-port.h via gmock-port.h.
+#if GTEST_HAS_STD_TYPE_TRAITS_ // Defined by gtest-port.h via gmock-port.h.
#include <type_traits>
#endif
@@ -96,7 +96,7 @@ struct BuiltInDefaultValueGetter<T, false> {
template <typename T>
class BuiltInDefaultValue {
public:
-#if GTEST_LANG_CXX11
+#if GTEST_HAS_STD_TYPE_TRAITS_
// This function returns true iff type T has a built-in default value.
static bool Exists() {
return ::std::is_default_constructible<T>::value;
@@ -107,7 +107,7 @@ class BuiltInDefaultValue {
T, ::std::is_default_constructible<T>::value>::Get();
}
-#else // GTEST_LANG_CXX11
+#else // GTEST_HAS_STD_TYPE_TRAITS_
// This function returns true iff type T has a built-in default value.
static bool Exists() {
return false;
@@ -117,7 +117,7 @@ class BuiltInDefaultValue {
return BuiltInDefaultValueGetter<T, false>::Get();
}
-#endif // GTEST_LANG_CXX11
+#endif // GTEST_HAS_STD_TYPE_TRAITS_
};
// This partial specialization says that we use the same built-in
diff --git a/googlemock/test/gmock-actions_test.cc b/googlemock/test/gmock-actions_test.cc
index a665fc5..f470de4 100644
--- a/googlemock/test/gmock-actions_test.cc
+++ b/googlemock/test/gmock-actions_test.cc
@@ -214,7 +214,7 @@ class MyNonDefaultConstructible {
int value_;
};
-#if GTEST_LANG_CXX11
+#if GTEST_HAS_STD_TYPE_TRAITS_
TEST(BuiltInDefaultValueTest, ExistsForDefaultConstructibleType) {
EXPECT_TRUE(BuiltInDefaultValue<MyDefaultConstructible>::Exists());
@@ -224,7 +224,7 @@ TEST(BuiltInDefaultValueTest, IsDefaultConstructedForDefaultConstructibleType) {
EXPECT_EQ(42, BuiltInDefaultValue<MyDefaultConstructible>::Get().value());
}
-#endif // GTEST_LANG_CXX11
+#endif // GTEST_HAS_STD_TYPE_TRAITS_
TEST(BuiltInDefaultValueTest, DoesNotExistForNonDefaultConstructibleType) {
EXPECT_FALSE(BuiltInDefaultValue<MyNonDefaultConstructible>::Exists());
diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc
index b09acba..2ff5556 100644
--- a/googlemock/test/gmock-matchers_test.cc
+++ b/googlemock/test/gmock-matchers_test.cc
@@ -1042,14 +1042,14 @@ TEST(IsNullTest, ReferenceToConstLinkedPtr) {
EXPECT_FALSE(m.Matches(non_null_p));
}
-#if GTEST_LANG_CXX11
+#if GTEST_HAS_STD_FUNCTION_
TEST(IsNullTest, StdFunction) {
const Matcher<std::function<void()>> m = IsNull();
EXPECT_TRUE(m.Matches(std::function<void()>()));
EXPECT_FALSE(m.Matches([]{}));
}
-#endif // GTEST_LANG_CXX11
+#endif // GTEST_HAS_STD_FUNCTION_
// Tests that IsNull() describes itself properly.
TEST(IsNullTest, CanDescribeSelf) {
@@ -1090,14 +1090,14 @@ TEST(NotNullTest, ReferenceToConstLinkedPtr) {
EXPECT_TRUE(m.Matches(non_null_p));
}
-#if GTEST_LANG_CXX11
+#if GTEST_HAS_STD_FUNCTION_
TEST(NotNullTest, StdFunction) {
const Matcher<std::function<void()>> m = NotNull();
EXPECT_TRUE(m.Matches([]{}));
EXPECT_FALSE(m.Matches(std::function<void()>()));
}
-#endif // GTEST_LANG_CXX11
+#endif // GTEST_HAS_STD_FUNCTION_
// Tests that NotNull() describes itself properly.
TEST(NotNullTest, CanDescribeSelf) {