From 6e25e8b7857de7f688c673ba700384f85b4113d4 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 11 Mar 2010 11:39:37 +0100 Subject: make it possible to use sse2 with mingw All the windows callback functions need an attribute to force the alignment of the arg pointer. Reviewed-by: Benjamin Poulain --- src/3rdparty/phonon/waveout/mediaobject.cpp | 2 +- src/3rdparty/phonon/waveout/mediaobject.h | 2 +- src/activeqt/control/qaxserverbase.cpp | 6 +++--- src/corelib/global/qglobal.h | 10 ++++++++++ src/corelib/io/qprocess_win.cpp | 2 +- src/corelib/kernel/qeventdispatcher_win.cpp | 8 ++++---- src/corelib/kernel/qeventdispatcher_win_p.h | 6 +++--- src/gui/dialogs/qfiledialog_win_p.h | 2 +- src/gui/kernel/qapplication_win.cpp | 5 ++--- src/gui/kernel/qdesktopwidget_win.cpp | 4 ++-- src/gui/kernel/qkeymapper_win.cpp | 2 +- src/gui/kernel/qwidget_win.cpp | 4 ++-- src/gui/kernel/qwidget_wince.cpp | 4 ++-- src/multimedia/audio/qaudioinput_win32_p.cpp | 2 +- src/multimedia/audio/qaudiooutput_win32_p.cpp | 2 +- src/multimedia/audio/qaudiooutput_win32_p.h | 2 +- src/qt3support/other/q3process_win.cpp | 2 +- 17 files changed, 37 insertions(+), 28 deletions(-) diff --git a/src/3rdparty/phonon/waveout/mediaobject.cpp b/src/3rdparty/phonon/waveout/mediaobject.cpp index 08af4ee..fdd81a7 100644 --- a/src/3rdparty/phonon/waveout/mediaobject.cpp +++ b/src/3rdparty/phonon/waveout/mediaobject.cpp @@ -70,7 +70,7 @@ namespace Phonon } - void CALLBACK MediaObject::WaveOutCallBack(HWAVEOUT m_hWaveOut, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2) + void QT_WIN_CALLBACK MediaObject::WaveOutCallBack(HWAVEOUT m_hWaveOut, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2) { Q_UNUSED(m_hWaveOut); Q_UNUSED(dwInstance); diff --git a/src/3rdparty/phonon/waveout/mediaobject.h b/src/3rdparty/phonon/waveout/mediaobject.h index dd6b24b..bb1410a 100644 --- a/src/3rdparty/phonon/waveout/mediaobject.h +++ b/src/3rdparty/phonon/waveout/mediaobject.h @@ -112,7 +112,7 @@ namespace Phonon void deleteValidWaveOutDevice(); void playBuffer(WAVEHDR *waveHeader); - static void CALLBACK WaveOutCallBack(HWAVEOUT hWaveOut, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2); + static void QT_WIN_CALLBACK WaveOutCallBack(HWAVEOUT hWaveOut, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2); struct { WAVEHDR *waveHeader; diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp index ce71490..ca16b39 100644 --- a/src/activeqt/control/qaxserverbase.cpp +++ b/src/activeqt/control/qaxserverbase.cpp @@ -160,7 +160,7 @@ public: void createMenu(QMenuBar *menuBar); void removeMenu(); - static LRESULT CALLBACK ActiveXProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); + static LRESULT QT_WIN_CALLBACK ActiveXProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); // Object registration with OLE void registerActiveObject(IUnknown *object); @@ -764,7 +764,7 @@ private: }; // callback for DLL server to hook into non-Qt eventloop -LRESULT CALLBACK axs_FilterProc(int nCode, WPARAM wParam, LPARAM lParam) +LRESULT QT_WIN_CALLBACK axs_FilterProc(int nCode, WPARAM wParam, LPARAM lParam) { if (qApp && !invokeCount) qApp->sendPostedEvents(); @@ -1350,7 +1350,7 @@ class HackWidget : public QWidget The semantics of \a wParam and \a lParam depend on the value of \a uMsg. */ -LRESULT CALLBACK QAxServerBase::ActiveXProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +LRESULT QT_WIN_CALLBACK QAxServerBase::ActiveXProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (uMsg == WM_CREATE) { CREATESTRUCT *cs = (CREATESTRUCT*)lParam; diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 4d48b60..6437fb7 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1064,6 +1064,16 @@ redefine to built-in booleans to make autotests work properly */ # define QT_FASTCALL #endif +//defines the type for the WNDPROC on windows +//the alignment needs to be forced for sse2 to not crash with mingw +#if defined(Q_WS_WIN) +# if defined(Q_CC_MINGW) +# define QT_WIN_CALLBACK CALLBACK __attribute__ ((force_align_arg_pointer)) +# else +# define QT_WIN_CALLBACK CALLBACK +# endif +#endif + typedef int QNoImplicitBoolCast; #if defined(QT_ARCH_ARM) || defined(QT_ARCH_ARMV6) || defined(QT_ARCH_AVR32) || (defined(QT_ARCH_MIPS) && (defined(Q_WS_QWS) || defined(Q_OS_WINCE))) || defined(QT_ARCH_SH) || defined(QT_ARCH_SH4A) diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index f3fc28e..cb25a58 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -525,7 +525,7 @@ qint64 QProcessPrivate::readFromStderr(char *data, qint64 maxlen) } -static BOOL CALLBACK qt_terminateApp(HWND hwnd, LPARAM procId) +static BOOL QT_WIN_CALLBACK qt_terminateApp(HWND hwnd, LPARAM procId) { DWORD currentProcId = 0; GetWindowThreadProcessId(hwnd, ¤tProcId); diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 4755540..2633a7c 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -308,7 +308,7 @@ typedef MMRESULT(WINAPI *ptimeKillEvent)(UINT); static ptimeSetEvent qtimeSetEvent = 0; static ptimeKillEvent qtimeKillEvent = 0; -LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp); +LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp); static void resolveTimerAPI() { @@ -420,7 +420,7 @@ Q_CORE_EXPORT bool winGetMessage(MSG* msg, HWND hWnd, UINT wMsgFilterMin, } // This function is called by a workerthread -void WINAPI CALLBACK qt_fast_timer_proc(uint timerId, uint /*reserved*/, DWORD_PTR user, DWORD_PTR /*reserved*/, DWORD_PTR /*reserved*/) +void WINAPI QT_WIN_CALLBACK qt_fast_timer_proc(uint timerId, uint /*reserved*/, DWORD_PTR user, DWORD_PTR /*reserved*/, DWORD_PTR /*reserved*/) { if (!timerId) // sanity check return; @@ -429,7 +429,7 @@ void WINAPI CALLBACK qt_fast_timer_proc(uint timerId, uint /*reserved*/, DWORD_P QCoreApplication::postEvent(t->dispatcher, new QTimerEvent(t->timerId)); } -LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) +LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) { if (message == WM_NCCREATE) return true; @@ -506,7 +506,7 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) return DefWindowProc(hwnd, message, wp, lp); } -LRESULT CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp) +LRESULT QT_WIN_CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp) { if (wp == PM_REMOVE) { QEventDispatcherWin32 *q = qobject_cast(QAbstractEventDispatcher::instance()); diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h index ed94c49..788cc44 100644 --- a/src/corelib/kernel/qeventdispatcher_win_p.h +++ b/src/corelib/kernel/qeventdispatcher_win_p.h @@ -62,7 +62,7 @@ class QWinEventNotifier; class QEventDispatcherWin32Private; // forward declaration -LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp); +LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp); class Q_CORE_EXPORT QEventDispatcherWin32 : public QAbstractEventDispatcher { @@ -101,8 +101,8 @@ public: bool event(QEvent *e); private: - friend LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp); - friend LRESULT CALLBACK qt_GetMessageHook(int, WPARAM, LPARAM); + friend LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp); + friend LRESULT QT_WIN_CALLBACK qt_GetMessageHook(int, WPARAM, LPARAM); }; QT_END_NAMESPACE diff --git a/src/gui/dialogs/qfiledialog_win_p.h b/src/gui/dialogs/qfiledialog_win_p.h index 44b7e43..7079925 100644 --- a/src/gui/dialogs/qfiledialog_win_p.h +++ b/src/gui/dialogs/qfiledialog_win_p.h @@ -82,7 +82,7 @@ typedef int GETPROPERTYSTOREFLAGS; #define GPS_BESTEFFORT 0x00000040 #define GPS_MASK_VALID 0x0000007F -typedef int (CALLBACK* BFFCALLBACK)(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData); +typedef int (QT_WIN_CALLBACK* BFFCALLBACK)(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData); // message from browser #define BFFM_INITIALIZED 1 #define BFFM_SELCHANGED 2 diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 9872514..ae9b34c 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -441,7 +441,7 @@ extern QCursor *qt_grab_cursor(); #define __export #endif -extern "C" LRESULT CALLBACK QtWndProc(HWND, UINT, WPARAM, LPARAM); +extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND, UINT, WPARAM, LPARAM); class QETWidget : public QWidget // event translator widget { @@ -1400,8 +1400,7 @@ static bool qt_is_translatable_mouse_event(UINT message) ; } -extern "C" -LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { bool result = true; QEvent::Type evt_type = QEvent::None; diff --git a/src/gui/kernel/qdesktopwidget_win.cpp b/src/gui/kernel/qdesktopwidget_win.cpp index 1fea8d6..07dbc24 100644 --- a/src/gui/kernel/qdesktopwidget_win.cpp +++ b/src/gui/kernel/qdesktopwidget_win.cpp @@ -76,7 +76,7 @@ public: }; typedef BOOL (WINAPI *InfoFunc)(HMONITOR, MONITORINFO*); - typedef BOOL (CALLBACK *EnumProc)(HMONITOR, HDC, LPRECT, LPARAM); + typedef BOOL (QT_WIN_CALLBACK *EnumProc)(HMONITOR, HDC, LPRECT, LPARAM); typedef BOOL (WINAPI *EnumFunc)(HDC, LPCRECT, EnumProc, LPARAM); static EnumFunc enumDisplayMonitors; @@ -107,7 +107,7 @@ static inline void qt_get_sip_info(QRect &rect) #endif -BOOL CALLBACK enumCallback(HMONITOR hMonitor, HDC, LPRECT, LPARAM) +BOOL QT_WIN_CALLBACK enumCallback(HMONITOR hMonitor, HDC, LPRECT, LPARAM) { QDesktopWidgetPrivate::screenCount++; QDesktopWidgetPrivate::rects->resize(QDesktopWidgetPrivate::screenCount); diff --git a/src/gui/kernel/qkeymapper_win.cpp b/src/gui/kernel/qkeymapper_win.cpp index e555c5c..f84b902 100644 --- a/src/gui/kernel/qkeymapper_win.cpp +++ b/src/gui/kernel/qkeymapper_win.cpp @@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE //#define DEBUG_KEYMAPPER // Implemented elsewhere -extern "C" LRESULT CALLBACK QtWndProc(HWND, UINT, WPARAM, LPARAM); +extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND, UINT, WPARAM, LPARAM); extern Q_CORE_EXPORT QLocale qt_localeFromLCID(LCID id); #ifndef LANG_PASHTO diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index 2dcbfc3..7d647b7 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -243,7 +243,7 @@ static QCursor *mouseGrbCur = 0; static QWidget *keyboardGrb = 0; static HHOOK journalRec = 0; -extern "C" LRESULT CALLBACK QtWndProc(HWND, UINT, WPARAM, LPARAM); +extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND, UINT, WPARAM, LPARAM); #define XCOORD_MAX 16383 #define WRECT_MAX 16383 @@ -825,7 +825,7 @@ QCursor *qt_grab_cursor() // The procedure does nothing, but is required for mousegrabbing to work #ifndef Q_WS_WINCE -LRESULT CALLBACK qJournalRecordProc(int nCode, WPARAM wParam, LPARAM lParam) +LRESULT QT_WIN_CALLBACK qJournalRecordProc(int nCode, WPARAM wParam, LPARAM lParam) { return CallNextHookEx(journalRec, nCode, wParam, lParam); } diff --git a/src/gui/kernel/qwidget_wince.cpp b/src/gui/kernel/qwidget_wince.cpp index fa94703..509847b 100644 --- a/src/gui/kernel/qwidget_wince.cpp +++ b/src/gui/kernel/qwidget_wince.cpp @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE const QString qt_reg_winclass(QWidget *w); // defined in qapplication_win.cpp -extern "C" LRESULT CALLBACK QtWndProc(HWND, UINT, WPARAM, LPARAM); +extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND, UINT, WPARAM, LPARAM); //#define TABLET_DEBUG #define PACKETDATA (PK_X | PK_Y | PK_BUTTONS | PK_NORMAL_PRESSURE | PK_TANGENT_PRESSURE \ @@ -586,7 +586,7 @@ void QWidgetPrivate::setWindowOpacity_sys(qreal level) { } // The procedure does nothing, but is required for mousegrabbing to work -LRESULT CALLBACK qJournalRecordProc(int nCode, WPARAM wParam, LPARAM lParam) { +LRESULT QT_WIN_CALLBACK qJournalRecordProc(int nCode, WPARAM wParam, LPARAM lParam) { Q_UNUSED(nCode); Q_UNUSED(wParam); Q_UNUSED(lParam); diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index 594f6ca..180cbda 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -88,7 +88,7 @@ QAudioInputPrivate::~QAudioInputPrivate() DeleteCriticalSection(&waveInCriticalSection); } -void CALLBACK QAudioInputPrivate::waveInProc( HWAVEIN hWaveIn, UINT uMsg, +void QT_WIN_CALLBACK QAudioInputPrivate::waveInProc( HWAVEIN hWaveIn, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ) { Q_UNUSED(dwParam1) diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index 6200160..c7f5752 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -88,7 +88,7 @@ QAudioOutputPrivate::~QAudioOutputPrivate() DeleteCriticalSection(&waveOutCriticalSection); } -void CALLBACK QAudioOutputPrivate::waveOutProc( HWAVEOUT hWaveOut, UINT uMsg, +void QT_WIN_CALLBACK QAudioOutputPrivate::waveOutProc( HWAVEOUT hWaveOut, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ) { Q_UNUSED(dwParam1) diff --git a/src/multimedia/audio/qaudiooutput_win32_p.h b/src/multimedia/audio/qaudiooutput_win32_p.h index 6e0899f..bb176a0 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.h +++ b/src/multimedia/audio/qaudiooutput_win32_p.h @@ -116,7 +116,7 @@ private: qint64 totalTimeValue; bool pullMode; int intervalTime; - static void CALLBACK waveOutProc( HWAVEOUT hWaveOut, UINT uMsg, + static void QT_WIN_CALLBACK waveOutProc( HWAVEOUT hWaveOut, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ); WAVEHDR* allocateBlocks(int size, int count); diff --git a/src/qt3support/other/q3process_win.cpp b/src/qt3support/other/q3process_win.cpp index da39bdc..9b69520 100644 --- a/src/qt3support/other/q3process_win.cpp +++ b/src/qt3support/other/q3process_win.cpp @@ -384,7 +384,7 @@ bool Q3Process::start( QStringList *env ) return true; } -static BOOL CALLBACK qt_terminateApp( HWND hwnd, LPARAM procId ) +static BOOL QT_WIN_CALLBACK qt_terminateApp( HWND hwnd, LPARAM procId ) { DWORD procId_win; GetWindowThreadProcessId( hwnd, &procId_win ); -- cgit v0.12