Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build fixed for mingw 5.3 #866

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion googletest/include/gtest/internal/gtest-port.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions googletest/src/gtest-port.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -250,15 +250,15 @@ 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;
}
}

void Mutex::Lock() {
ThreadSafeLazyInit();
::EnterCriticalSection(critical_section_);
::EnterCriticalSection((CRITICAL_SECTION*)critical_section_);
owner_thread_id_ = ::GetCurrentThreadId();
}

Expand All @@ -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
Expand All @@ -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(
Expand Down
10 changes: 5 additions & 5 deletions googletest/test/gtest-printers_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion googletest/test/gtest_catch_exceptions_test_.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down