aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGennadiy Civil <gennadiycivil@users.noreply.github.com>2017-11-07 10:32:23 -0800
committerGitHub <noreply@github.com>2017-11-07 10:32:23 -0800
commit49eb76df471857fe1bd573b0636b1f9dd4fc8e4f (patch)
tree156d379675f771d096d84a2ced2972b46ed83a4a
parentceee80c383d6f34af1a4e0fbb464f3f144cded68 (diff)
parentd175c8bf823e709d570772b038757fadf63bc632 (diff)
downloadgoogletest-49eb76df471857fe1bd573b0636b1f9dd4fc8e4f.tar.gz
googletest-49eb76df471857fe1bd573b0636b1f9dd4fc8e4f.tar.bz2
googletest-49eb76df471857fe1bd573b0636b1f9dd4fc8e4f.zip
Merge branch 'master' into hethi/issue-360-remove-GTEST_HAS_PARAM_TESTS
-rw-r--r--.gitignore14
-rw-r--r--.travis.yml2
-rw-r--r--appveyor.yml8
-rw-r--r--googlemock/docs/CheatSheet.md2
-rw-r--r--googlemock/include/gmock/gmock-generated-matchers.h36
-rw-r--r--googlemock/include/gmock/gmock-generated-matchers.h.pump3
-rw-r--r--googlemock/test/gmock-generated-matchers_test.cc8
-rw-r--r--googlemock/test/gmock-matchers_test.cc12
-rw-r--r--googletest/README.md14
-rw-r--r--googletest/cmake/internal_utils.cmake8
-rw-r--r--googletest/docs/FAQ.md8
-rw-r--r--googletest/include/gtest/internal/gtest-port.h15
-rw-r--r--googletest/test/gtest-printers_test.cc51
-rw-r--r--googletest/test/gtest_catch_exceptions_test_.cc2
14 files changed, 136 insertions, 47 deletions
diff --git a/.gitignore b/.gitignore
index 8f89b801..4cea432f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,4 +9,16 @@ bazel-googletest
bazel-out
bazel-testlogs
# python
-*.pyc \ No newline at end of file
+*.pyc
+
+# Visual Studio files
+*.sdf
+*.opensdf
+*.VC.opendb
+*.suo
+*.user
+_ReSharper.Caches/
+Win32-Debug/
+Win32-Release/
+x64-Debug/
+x64-Release/
diff --git a/.travis.yml b/.travis.yml
index 418720fd..68acbd36 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,7 +9,7 @@ install:
# /usr/bin/clang is 3.4, lets override with modern one.
- if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="clang++-3.7" CC="clang-3.7"; ln -sf /usr/bin/ccache /$HOME/bin/$CXX; ln -sf /usr/bin/ccache /$HOME/bin/$CC; fi
# ccache on OS X needs installation first
-- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install ccache; export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi
+- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; brew install ccache; export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi
# reset ccache statistics
- ccache --zero-stats
- echo ${PATH}
diff --git a/appveyor.yml b/appveyor.yml
index f129d7c5..4e8d6f6e 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -4,6 +4,14 @@ os: Visual Studio 2015
environment:
matrix:
+ - compiler: msvc-15-seh
+ generator: "Visual Studio 15 2017"
+ APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
+
+ - compiler: msvc-15-seh
+ generator: "Visual Studio 15 2017 Win64"
+ APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
+
- compiler: msvc-14-seh
generator: "Visual Studio 14 2015"
diff --git a/googlemock/docs/CheatSheet.md b/googlemock/docs/CheatSheet.md
index c94c2dac..c6367fdd 100644
--- a/googlemock/docs/CheatSheet.md
+++ b/googlemock/docs/CheatSheet.md
@@ -65,7 +65,7 @@ can specify it by appending `_WITH_CALLTYPE` to any of the macros
described in the previous two sections and supplying the calling
convention as the first argument to the macro. For example,
```
- MOCK_METHOD_1_WITH_CALLTYPE(STDMETHODCALLTYPE, Foo, bool(int n));
+ MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, Foo, bool(int n));
MOCK_CONST_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, Bar, int(double x, double y));
```
where `STDMETHODCALLTYPE` is defined by `<objbase.h>` on Windows.
diff --git a/googlemock/include/gmock/gmock-generated-matchers.h b/googlemock/include/gmock/gmock-generated-matchers.h
index 525f8a71..1655bcd3 100644
--- a/googlemock/include/gmock/gmock-generated-matchers.h
+++ b/googlemock/include/gmock/gmock-generated-matchers.h
@@ -1376,7 +1376,8 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
// ================
//
// To learn more about using these macros, please search for 'MATCHER'
-// on https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md
+// on https://github.com/google/googletest/blob/master/googlemock/docs/
+// CookBook.md
#define MATCHER(name, description)\
class name##Matcher {\
@@ -1397,8 +1398,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
+ if (!gmock_description.empty()) {\
return gmock_description;\
+ }\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
@@ -1446,8 +1448,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
+ if (!gmock_description.empty()) {\
return gmock_description;\
+ }\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
@@ -1499,8 +1502,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
+ if (!gmock_description.empty()) {\
return gmock_description;\
+ }\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
@@ -1557,8 +1561,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
+ if (!gmock_description.empty()) {\
return gmock_description;\
+ }\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
@@ -1620,8 +1625,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
+ if (!gmock_description.empty()) {\
return gmock_description;\
+ }\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
@@ -1691,8 +1697,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
+ if (!gmock_description.empty()) {\
return gmock_description;\
+ }\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
@@ -1765,8 +1772,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
+ if (!gmock_description.empty()) {\
return gmock_description;\
+ }\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
@@ -1843,8 +1851,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
+ if (!gmock_description.empty()) {\
return gmock_description;\
+ }\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
@@ -1928,8 +1937,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
+ if (!gmock_description.empty()) {\
return gmock_description;\
+ }\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
@@ -2019,8 +2029,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
+ if (!gmock_description.empty()) {\
return gmock_description;\
+ }\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
@@ -2115,8 +2126,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
+ if (!gmock_description.empty()) {\
return gmock_description;\
+ }\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
diff --git a/googlemock/include/gmock/gmock-generated-matchers.h.pump b/googlemock/include/gmock/gmock-generated-matchers.h.pump
index f91b1eab..25d2da99 100644
--- a/googlemock/include/gmock/gmock-generated-matchers.h.pump
+++ b/googlemock/include/gmock/gmock-generated-matchers.h.pump
@@ -639,8 +639,9 @@ $var param_field_decls2 = [[$for j
private:\
::testing::internal::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
+ if (!gmock_description.empty()) {\
return gmock_description;\
+ }\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
diff --git a/googlemock/test/gmock-generated-matchers_test.cc b/googlemock/test/gmock-generated-matchers_test.cc
index 8234858d..6cba726d 100644
--- a/googlemock/test/gmock-generated-matchers_test.cc
+++ b/googlemock/test/gmock-generated-matchers_test.cc
@@ -120,7 +120,7 @@ TEST(ArgsTest, AcceptsOneTemplateArg) {
}
TEST(ArgsTest, AcceptsTwoTemplateArgs) {
- const tuple<short, int, long> t(4, 5, 6L); // NOLINT
+ const tuple<short, int, long> t(static_cast<short>(4), 5, 6L); // NOLINT
EXPECT_THAT(t, (Args<0, 1>(Lt())));
EXPECT_THAT(t, (Args<1, 2>(Lt())));
@@ -128,13 +128,13 @@ TEST(ArgsTest, AcceptsTwoTemplateArgs) {
}
TEST(ArgsTest, AcceptsRepeatedTemplateArgs) {
- const tuple<short, int, long> t(4, 5, 6L); // NOLINT
+ const tuple<short, int, long> t(static_cast<short>(4), 5, 6L); // NOLINT
EXPECT_THAT(t, (Args<0, 0>(Eq())));
EXPECT_THAT(t, Not(Args<1, 1>(Ne())));
}
TEST(ArgsTest, AcceptsDecreasingTemplateArgs) {
- const tuple<short, int, long> t(4, 5, 6L); // NOLINT
+ const tuple<short, int, long> t(static_cast<short>(4), 5, 6L); // NOLINT
EXPECT_THAT(t, (Args<2, 0>(Gt())));
EXPECT_THAT(t, Not(Args<2, 1>(Lt())));
}
@@ -159,7 +159,7 @@ TEST(ArgsTest, AcceptsMoreTemplateArgsThanArityOfOriginalTuple) {
}
TEST(ArgsTest, CanBeNested) {
- const tuple<short, int, long, int> t(4, 5, 6L, 6); // NOLINT
+ const tuple<short, int, long, int> t(static_cast<short>(4), 5, 6L, 6); // NOLINT
EXPECT_THAT(t, (Args<1, 2, 3>(Args<1, 2>(Eq()))));
EXPECT_THAT(t, (Args<0, 1, 3>(Args<0, 2>(Lt()))));
}
diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc
index fc867487..4beaec4c 100644
--- a/googlemock/test/gmock-matchers_test.cc
+++ b/googlemock/test/gmock-matchers_test.cc
@@ -58,6 +58,11 @@
# include <forward_list> // NOLINT
#endif
+// Disable MSVC2015 warning for std::pair: "decorated name length exceeded, name was truncated".
+#if defined(_MSC_VER) && (_MSC_VER == 1900)
+# pragma warning(disable:4503)
+#endif
+
namespace testing {
namespace internal {
@@ -3931,8 +3936,11 @@ TEST(ResultOfTest, WorksForFunctionReferences) {
// Tests that ResultOf(f, ...) compiles and works as expected when f is a
// function object.
-struct Functor : public ::std::unary_function<int, std::string> {
- result_type operator()(argument_type input) const {
+struct Functor {
+ typedef std::string result_type;
+ typedef int argument_type;
+
+ std::string operator()(int input) const {
return IntToStringFunction(input);
}
};
diff --git a/googletest/README.md b/googletest/README.md
index 0a3474c0..f273a7de 100644
--- a/googletest/README.md
+++ b/googletest/README.md
@@ -161,7 +161,8 @@ Existing build's `CMakeLists.txt`:
# Add googletest directly to our build. This defines
# the gtest and gtest_main targets.
add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src
- ${CMAKE_BINARY_DIR}/googletest-build)
+ ${CMAKE_BINARY_DIR}/googletest-build
+ EXCLUDE_FROM_ALL)
# The gtest/gtest_main targets carry header search path
# dependencies automatically when using CMake 2.8.11 or
@@ -182,6 +183,17 @@ technique is discussed in more detail in
which also contains a link to a fully generalized implementation
of the technique.
+##### Visual Studio Dynamic vs Static Runtimes #####
+
+By default, new Visual Studio projects link the C runtimes dynamically
+but Google Test links them statically.
+This will generate an error that looks something like the following:
+ gtest.lib(gtest-all.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in main.obj
+
+Google Test already has a CMake option for this: `gtest_force_shared_crt`
+
+Enabling this option will make gtest link the runtimes dynamically too,
+and match the project in which it is included.
### Legacy Build Scripts ###
diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake
index 9915c11f..c54bc94f 100644
--- a/googletest/cmake/internal_utils.cmake
+++ b/googletest/cmake/internal_utils.cmake
@@ -87,10 +87,6 @@ macro(config_compiler_and_linker)
# http://stackoverflow.com/questions/3232669 explains the issue.
set(cxx_base_flags "${cxx_base_flags} -wd4702")
endif()
- if (NOT (MSVC_VERSION GREATER 1900)) # 1900 is Visual Studio 2015
- # BigObj required for tests.
- set(cxx_base_flags "${cxx_base_flags} -bigobj")
- endif()
set(cxx_base_flags "${cxx_base_flags} -D_UNICODE -DUNICODE -DWIN32 -D_WIN32")
set(cxx_base_flags "${cxx_base_flags} -DSTRICT -DWIN32_LEAN_AND_MEAN")
@@ -187,6 +183,10 @@ endfunction()
# is built from the given source files with the given compiler flags.
function(cxx_executable_with_flags name cxx_flags libs)
add_executable(${name} ${ARGN})
+ if (MSVC AND (NOT (MSVC_VERSION LESS 1700))) # 1700 is Visual Studio 2012.
+ # BigObj required for tests.
+ set(cxx_flags "${cxx_flags} -bigobj")
+ endif()
if (cxx_flags)
set_target_properties(${name}
PROPERTIES
diff --git a/googletest/docs/FAQ.md b/googletest/docs/FAQ.md
index c39b6254..1a216a1a 100644
--- a/googletest/docs/FAQ.md
+++ b/googletest/docs/FAQ.md
@@ -494,7 +494,7 @@ EXPECT_PRED1(IsPositive, 5);
However, this will work:
``` cpp
-EXPECT_PRED1(*static_cast<bool (*)(int)>*(IsPositive), 5);
+EXPECT_PRED1(static_cast<bool (*)(int)>(IsPositive), 5);
```
(The stuff inside the angled brackets for the `static_cast` operator is the
@@ -512,14 +512,14 @@ bool IsNegative(T x) {
you can use it in a predicate assertion like this:
``` cpp
-ASSERT_PRED1(IsNegative*<int>*, -5);
+ASSERT_PRED1(IsNegative<int>, -5);
```
Things are more interesting if your template has more than one parameters. The
following won't compile:
``` cpp
-ASSERT_PRED2(*GreaterThan<int, int>*, 5, 0);
+ASSERT_PRED2(GreaterThan<int, int>, 5, 0);
```
@@ -528,7 +528,7 @@ which is one more than expected. The workaround is to wrap the predicate
function in parentheses:
``` cpp
-ASSERT_PRED2(*(GreaterThan<int, int>)*, 5, 0);
+ASSERT_PRED2((GreaterThan<int, int>), 5, 0);
```
diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h
index f303e237..d661e2ec 100644
--- a/googletest/include/gtest/internal/gtest-port.h
+++ b/googletest/include/gtest/internal/gtest-port.h
@@ -324,7 +324,7 @@
// -std={c,gnu}++{0x,11} is passed. The C++11 standard specifies a
// value for __cplusplus, and recent versions of clang, gcc, and
// probably other compilers set that too in C++11 mode.
-# if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L
+# if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L || _MSC_VER >= 1900
// Compiling in at least C++11 mode.
# define GTEST_LANG_CXX11 1
# else
@@ -356,12 +356,16 @@
#if GTEST_STDLIB_CXX11
# define GTEST_HAS_STD_BEGIN_AND_END_ 1
# define GTEST_HAS_STD_FORWARD_LIST_ 1
-# define GTEST_HAS_STD_FUNCTION_ 1
+# if !defined(_MSC_VER) || (_MSC_FULL_VER >= 190023824) // works only with VS2015U2 and better
+# define GTEST_HAS_STD_FUNCTION_ 1
+# endif
# define GTEST_HAS_STD_INITIALIZER_LIST_ 1
# define GTEST_HAS_STD_MOVE_ 1
# define GTEST_HAS_STD_SHARED_PTR_ 1
# define GTEST_HAS_STD_TYPE_TRAITS_ 1
# define GTEST_HAS_STD_UNIQUE_PTR_ 1
+# define GTEST_HAS_UNORDERED_MAP_ 1
+# define GTEST_HAS_UNORDERED_SET_ 1
#endif
// C++11 specifies that <tuple> provides std::tuple.
@@ -659,7 +663,8 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
// support TR1 tuple. libc++ only provides std::tuple, in C++11 mode,
// and it can be used with some compilers that define __GNUC__.
# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \
- && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) || _MSC_VER >= 1600
+ && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) \
+ || (_MSC_VER >= 1600 && _MSC_VER < 1900)
# define GTEST_ENV_HAS_TR1_TUPLE_ 1
# endif
@@ -2054,7 +2059,7 @@ extern "C" inline void DeleteThreadLocalValue(void* value_holder) {
// Implements thread-local storage on pthreads-based systems.
template <typename T>
-class ThreadLocal {
+class GTEST_API_ ThreadLocal {
public:
ThreadLocal()
: key_(CreateKey()), default_factory_(new DefaultValueHolderFactory()) {}
@@ -2186,7 +2191,7 @@ class GTestMutexLock {
typedef GTestMutexLock MutexLock;
template <typename T>
-class ThreadLocal {
+class GTEST_API_ ThreadLocal {
public:
ThreadLocal() : value_() {}
explicit ThreadLocal(const T& value) : value_(value) {}
diff --git a/googletest/test/gtest-printers_test.cc b/googletest/test/gtest-printers_test.cc
index 487d3cb3..2a6c017e 100644
--- a/googletest/test/gtest-printers_test.cc
+++ b/googletest/test/gtest-printers_test.cc
@@ -51,10 +51,15 @@
#include "gtest/gtest.h"
// hash_map and hash_set are available under Visual C++, or on Linux.
-#if GTEST_HAS_HASH_MAP_
+#if GTEST_HAS_UNORDERED_MAP_
+# include <unordered_map> // NOLINT
+#elif GTEST_HAS_HASH_MAP_
# include <hash_map> // NOLINT
#endif // GTEST_HAS_HASH_MAP_
-#if GTEST_HAS_HASH_SET_
+
+#if GTEST_HAS_UNORDERED_SET_
+# include <unordered_set> // NOLINT
+#elif GTEST_HAS_HASH_SET_
# include <hash_set> // NOLINT
#endif // GTEST_HAS_HASH_SET_
@@ -239,21 +244,47 @@ using ::testing::internal::UniversalTersePrintTupleFieldsToStrings;
#endif
using ::testing::internal::string;
-#if GTEST_HAS_HASH_MAP_
// The hash_* classes are not part of the C++ standard. STLport
// defines them in namespace std. MSVC defines them in ::stdext. GCC
// defines them in ::.
+#if GTEST_HAS_UNORDERED_MAP_
+
+#define GTEST_HAS_HASH_MAP_ 1
+template<class Key, class T>
+using hash_map = ::std::unordered_map<Key, T>;
+template<class Key, class T>
+using hash_multimap = ::std::unordered_multimap<Key, T>;
+
+#elif GTEST_HAS_HASH_MAP_
+
#ifdef _STLP_HASH_MAP // We got <hash_map> from STLport.
using ::std::hash_map;
-using ::std::hash_set;
using ::std::hash_multimap;
-using ::std::hash_multiset;
#elif _MSC_VER
using ::stdext::hash_map;
-using ::stdext::hash_set;
using ::stdext::hash_multimap;
+#endif
+
+#endif
+
+#if GTEST_HAS_UNORDERED_SET_
+
+#define GTEST_HAS_HASH_SET_ 1
+template<class Key>
+using hash_set = ::std::unordered_set<Key>;
+template<class Key>
+using hash_multiset = ::std::unordered_multiset<Key>;
+
+#elif GTEST_HAS_HASH_SET_
+
+#ifdef _STLP_HASH_MAP // We got <hash_map> from STLport.
+using ::std::hash_set;
+using ::std::hash_multiset;
+#elif _MSC_VER
+using ::stdext::hash_set;
using ::stdext::hash_multiset;
#endif
+
#endif
// Prints a value to a string using the universal value printer. This
@@ -1061,8 +1092,8 @@ TEST(PrintTr1TupleTest, VariousSizes) {
::std::tr1::tuple<bool, char, short, testing::internal::Int32, // NOLINT
testing::internal::Int64, float, double, const char*, void*,
std::string>
- t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str, ImplicitCast_<void*>(NULL),
- "10");
+ t10(false, 'a', static_cast<short>(3), 4, 5, 1.5F, -2.5, str,
+ ImplicitCast_<void*>(NULL), "10");
EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) +
" pointing to \"8\", NULL, \"10\")",
Print(t10));
@@ -1121,8 +1152,8 @@ TEST(PrintStdTupleTest, VariousSizes) {
::std::tuple<bool, char, short, testing::internal::Int32, // NOLINT
testing::internal::Int64, float, double, const char*, void*,
std::string>
- t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str, ImplicitCast_<void*>(NULL),
- "10");
+ t10(false, 'a', static_cast<short>(3), 4, 5, 1.5F, -2.5, str,
+ ImplicitCast_<void*>(NULL), "10");
EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) +
" pointing to \"8\", NULL, \"10\")",
Print(t10));
diff --git a/googletest/test/gtest_catch_exceptions_test_.cc b/googletest/test/gtest_catch_exceptions_test_.cc
index b42637ec..c6d953c0 100644
--- a/googletest/test/gtest_catch_exceptions_test_.cc
+++ b/googletest/test/gtest_catch_exceptions_test_.cc
@@ -138,7 +138,7 @@ TEST_F(CxxExceptionInConstructorTest, ThrowsExceptionInConstructor) {
}
// Exceptions in destructors are not supported in C++11.
-#if !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L && _MSC_VER < 1900
+#if !GTEST_LANG_CXX11
class CxxExceptionInDestructorTest : public Test {
public:
static void TearDownTestCase() {