Fix compilation with MinGW
authorJonathan Liu <net147@gmail.com>
Tue, 14 Feb 2012 12:27:32 +0000 (23:27 +1100)
committerQt by Nokia <qt-info@nokia.com>
Wed, 15 Feb 2012 07:59:29 +0000 (08:59 +0100)
Some headers and constants are available in MinGW-w64 that are not
available in the official MinGW. STATE_SYSTEM_HASPOPUP and
STATE_SYSTEM_PROTECTED constants are defined if they are not already
defined by including oleacc.h. _CrtSetReportMode is not used and
crtdbg.h is not included when using official MinGW as crtdbg.h is
missing from official MinGW.

Change-Id: Ie7f3f3726a1663d0fdeb6ee17b86873ae3f61860
Reviewed-by: Jonathan Liu <net147@gmail.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
src/plugins/platforms/windows/qtwindows_additional.h
src/plugins/platforms/windows/qwindowsaccessibility.cpp
src/testlib/qtestcase.cpp

index a85a798..ab51f36 100644 (file)
@@ -68,6 +68,9 @@
 
 #if !defined(__MINGW64_VERSION_MAJOR)
 
+#define STATE_SYSTEM_HASPOPUP 0x40000000
+#define STATE_SYSTEM_PROTECTED 0x20000000
+
 typedef struct tagUPDATELAYEREDWINDOWINFO {
   DWORD               cbSize;
   HDC                 hdcDst;
index e36e255..3ef21fa 100644 (file)
@@ -84,6 +84,8 @@
 #include "qguifunctions_wince.h"
 #endif
 
+#include "qtwindows_additional.h"
+
 QT_BEGIN_NAMESPACE
 
 //#define DEBUG_SHOW_ATCLIENT_COMMANDS
index 76bea24..549d16b 100644 (file)
@@ -70,7 +70,9 @@
 
 #ifdef Q_OS_WIN
 #ifndef Q_OS_WINCE
-# include <crtdbg.h>
+# if !defined(Q_CC_MINGW) || (defined(Q_CC_MINGW) && defined(__MINGW64_VERSION_MAJOR))
+#  include <crtdbg.h>
+# endif
 #endif
 #include <windows.h> // for Sleep
 #endif
@@ -1947,7 +1949,9 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
 #endif
 
 #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+# if !defined(Q_CC_MINGW) || (defined(Q_CC_MINGW) && defined(__MINGW64_VERSION_MAJOR))
     _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG);
+# endif
     SetErrorMode(SetErrorMode(0) | SEM_NOGPFAULTERRORBOX);
 #endif