mirror of
https://github.com/opencv/opencv.git
synced 2025-08-06 06:26:29 +08:00
Fix for opencv/opencv#8105 (compiling with mingw32)
fix for opencv/opencv#8105, compilation issue with mingw32 (in google/googletest#721 a similar issue was solved and the reason was described as MinGW defines _CRITICAL_SECTION and _RTL_CRITICAL_SECTION as two separate (equivalent) structs, instead of using typedef)
This commit is contained in:
parent
ece3fac7ef
commit
9a1835ce66
@ -720,10 +720,16 @@
|
|||||||
# include <io.h>
|
# include <io.h>
|
||||||
# endif
|
# endif
|
||||||
// In order to avoid having to include <windows.h>, use forward declaration
|
// 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
|
||||||
// This assumption is verified by
|
// MinGW defined _CRITICAL_SECTION and _RTL_CRITICAL_SECTION as two
|
||||||
// WindowsTypesTest.CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION.
|
// separate (equivalent) structs, instead of using typedef
|
||||||
struct _RTL_CRITICAL_SECTION;
|
typedef struct _CRITICAL_SECTION GTEST_CRITICAL_SECTION;
|
||||||
|
# else
|
||||||
|
// assuming CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION.
|
||||||
|
// This assumption is verified by
|
||||||
|
// WindowsTypesTest.CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION.
|
||||||
|
typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
// This assumes that non-Windows OSes provide unistd.h. For OSes where this
|
// 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
|
// is not the case, we need to include headers that provide the functions
|
||||||
@ -3057,7 +3063,7 @@ class GTEST_API_ Mutex {
|
|||||||
// by the linker.
|
// by the linker.
|
||||||
MutexType type_;
|
MutexType type_;
|
||||||
long critical_section_init_phase_; // NOLINT
|
long critical_section_init_phase_; // NOLINT
|
||||||
_RTL_CRITICAL_SECTION* critical_section_;
|
GTEST_CRITICAL_SECTION* critical_section_;
|
||||||
|
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user