summaryrefslogtreecommitdiffstats
path: root/googletest/include/gtest
diff options
context:
space:
mode:
authorDaniele Tamino <daniele.tamino@gmail.com>2016-02-20 03:06:12 (GMT)
committerDaniele Tamino <daniele.tamino@gmail.com>2016-02-22 22:07:12 (GMT)
commit9759dcda3c2f9c174521b9269018f79f55c29df8 (patch)
treec8c379b2e60c58f4adde26931bc9dc9d574edcb1 /googletest/include/gtest
parentff07a5de0e81580547f1685e101194ed1a4fcd56 (diff)
downloadgoogletest-9759dcda3c2f9c174521b9269018f79f55c29df8.zip
googletest-9759dcda3c2f9c174521b9269018f79f55c29df8.tar.gz
googletest-9759dcda3c2f9c174521b9269018f79f55c29df8.tar.bz2
Fix compilation on MinGW with native threads
Diffstat (limited to 'googletest/include/gtest')
-rw-r--r--googletest/include/gtest/internal/gtest-port.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h
index 7d6e465..634b9ab 100644
--- a/googletest/include/gtest/internal/gtest-port.h
+++ b/googletest/include/gtest/internal/gtest-port.h
@@ -396,10 +396,16 @@
# include <io.h>
# endif
// In order to avoid having to include <windows.h>, use forward declaration
-// assuming CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION.
+#if GTEST_OS_WINDOWS_MINGW
+// MinGW defined _CRITICAL_SECTION and _RTL_CRITICAL_SECTION as two
+// separate (equivalent) structs, instead of using typedef
+typedef struct _CRITICAL_SECTION GTEST_CRITICAL_SECTION;
+#else
+// Assume CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION.
// This assumption is verified by
// WindowsTypesTest.CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION.
-struct _RTL_CRITICAL_SECTION;
+typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
+#endif
#else
// This assumes that non-Windows OSes provide unistd.h. For OSes where this
// is not the case, we need to include headers that provide the functions
@@ -1693,7 +1699,7 @@ class GTEST_API_ Mutex {
// by the linker.
MutexType type_;
long critical_section_init_phase_; // NOLINT
- _RTL_CRITICAL_SECTION* critical_section_;
+ GTEST_CRITICAL_SECTION* critical_section_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
};