diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 92f4c11c4f..2ed0bcaf66 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -622,7 +622,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // Determines if hash_map/hash_set are available. // Only used for testing against those containers. #if !defined(GTEST_HAS_HASH_MAP_) -# if _MSC_VER +# if defined (_MSC_VER) && (_MSC_VER < 1900) # define GTEST_HAS_HASH_MAP_ 1 // Indicates that hash_map is available. # define GTEST_HAS_HASH_SET_ 1 // Indicates that hash_set is available. # endif // _MSC_VER diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc index e5bf3dd2be..f9f7656d7e 100644 --- a/googletest/src/gtest-port.cc +++ b/googletest/src/gtest-port.cc @@ -239,8 +239,8 @@ Mutex::Mutex() : owner_thread_id_(0), type_(kDynamic), critical_section_init_phase_(0), - critical_section_(new CRITICAL_SECTION) { - ::InitializeCriticalSection(critical_section_); + critical_section_((GTEST_CRITICAL_SECTION*)new CRITICAL_SECTION) { + ::InitializeCriticalSection((CRITICAL_SECTION*)critical_section_); } Mutex::~Mutex() { @@ -250,7 +250,7 @@ Mutex::~Mutex() { // nothing to clean it up but is available only on Vista and later. // http://msdn.microsoft.com/en-us/library/windows/desktop/aa904937.aspx if (type_ == kDynamic) { - ::DeleteCriticalSection(critical_section_); + ::DeleteCriticalSection((CRITICAL_SECTION*)critical_section_); delete critical_section_; critical_section_ = NULL; } @@ -258,7 +258,7 @@ Mutex::~Mutex() { void Mutex::Lock() { ThreadSafeLazyInit(); - ::EnterCriticalSection(critical_section_); + ::EnterCriticalSection((CRITICAL_SECTION*)critical_section_); owner_thread_id_ = ::GetCurrentThreadId(); } @@ -268,7 +268,7 @@ void Mutex::Unlock() { // caller's responsibility to ensure that the current thread holds the // mutex when this is called. owner_thread_id_ = 0; - ::LeaveCriticalSection(critical_section_); + ::LeaveCriticalSection((CRITICAL_SECTION*)critical_section_); } // Does nothing if the current thread holds the mutex. Otherwise, crashes @@ -289,8 +289,8 @@ void Mutex::ThreadSafeLazyInit() { // If critical_section_init_phase_ was 0 before the exchange, we // are the first to test it and need to perform the initialization. owner_thread_id_ = 0; - critical_section_ = new CRITICAL_SECTION; - ::InitializeCriticalSection(critical_section_); + critical_section_ = (GTEST_CRITICAL_SECTION*)new CRITICAL_SECTION; + ::InitializeCriticalSection((CRITICAL_SECTION*)critical_section_); // Updates the critical_section_init_phase_ to 2 to signal // initialization complete. GTEST_CHECK_(::InterlockedCompareExchange( diff --git a/googletest/test/gtest-printers_test.cc b/googletest/test/gtest-printers_test.cc index 3e97cc24ab..51afb4f548 100644 --- a/googletest/test/gtest-printers_test.cc +++ b/googletest/test/gtest-printers_test.cc @@ -222,11 +222,11 @@ 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; -using ::stdext::hash_multiset; +#elif _MSC_VER && GTEST_HAS_HASH_MAP_ + using ::stdext::hash_map; + using ::stdext::hash_set; + using ::stdext::hash_multimap; + using ::stdext::hash_multiset; #endif // Prints a value to a string using the universal value printer. This diff --git a/googletest/test/gtest_catch_exceptions_test_.cc b/googletest/test/gtest_catch_exceptions_test_.cc index d0fc82c998..41c5e43bf5 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 +#if !defined(__GXX_EXPERIMENTAL_CXX0X__) && (__cplusplus < 201103L) && (_MSC_VER < 1900) class CxxExceptionInDestructorTest : public Test { public: static void TearDownTestCase() {