From 72372c2219074d06a2e9cb856cb08b4a21880972 Mon Sep 17 00:00:00 2001 From: gigaherz Date: Sun, 19 Aug 2012 19:36:59 +0000 Subject: [PATCH] Make PCSX2 compile with Visual Studio 2012 (1/3): Workaround compiler differences that result in compile-time errors. NOTE: The 'glew' project does NOT build yet, but it will have to be decided how to approach the problem (String literal too long in glew.rc) git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5382 96395faa-99c1-11dd-bbfe-3dabce05a288 --- .../portaudio/src/os/win/pa_win_wdmks_utils.c | 2 +- 3rdparty/w32pthreads/include/implement.h | 3 ++- 3rdparty/wxWidgets/include/wx/list.h | 17 +++++++++++++---- 3rdparty/wxWidgets/src/msw/window.cpp | 2 ++ common/include/Utilities/wxAppWithHelpers.h | 2 +- pcsx2/gui/pxEventThread.h | 2 +- plugins/GSdx/stdafx.h | 10 +++++++--- 7 files changed, 27 insertions(+), 11 deletions(-) diff --git a/3rdparty/portaudio/src/os/win/pa_win_wdmks_utils.c b/3rdparty/portaudio/src/os/win/pa_win_wdmks_utils.c index 0dc0b4bdea..3e12c4e04b 100644 --- a/3rdparty/portaudio/src/os/win/pa_win_wdmks_utils.c +++ b/3rdparty/portaudio/src/os/win/pa_win_wdmks_utils.c @@ -56,7 +56,7 @@ #include "pa_win_wdmks_utils.h" #if !defined(PA_WDMKS_NO_KSGUID_LIB) && !defined(PAWIN_WDMKS_NO_KSGUID_LIB) - #if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) /* MSC version 6 and above */ + #if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200) && (_MSC_VER < 1600))) /* MSC version 6 up to 2008 */ #pragma comment( lib, "ksguid.lib" ) #endif #define pa_KSDATAFORMAT_TYPE_AUDIO KSDATAFORMAT_TYPE_AUDIO diff --git a/3rdparty/w32pthreads/include/implement.h b/3rdparty/w32pthreads/include/implement.h index 17fc2311ce..f7d1931549 100644 --- a/3rdparty/w32pthreads/include/implement.h +++ b/3rdparty/w32pthreads/include/implement.h @@ -649,7 +649,6 @@ extern "C" # include #endif - static INLINE void* _InterlockedExchangePointer( void* volatile* target, void* value ) { #ifdef _M_AMD64 // high-level atomic ops, please leave these 64 bit checks in place. @@ -659,6 +658,7 @@ static INLINE void* _InterlockedExchangePointer( void* volatile* target, void* v #endif } +#if _MSC_VER < 1700 static INLINE void* _InterlockedCompareExchangePointer( void* volatile* target, void* value, void* comparand ) { #ifdef _M_AMD64 // high-level atomic ops, please leave these 64 bit checks in place. @@ -667,6 +667,7 @@ static INLINE void* _InterlockedCompareExchangePointer( void* volatile* target, return (void*)_InterlockedCompareExchange( (LONG_PTR*)target, (LONG_PTR)value, (LONG_PTR)comparand ); #endif } +#endif static INLINE void* _InterlockedExchangeAddPointer( void* volatile* target, void* value ) { diff --git a/3rdparty/wxWidgets/include/wx/list.h b/3rdparty/wxWidgets/include/wx/list.h index 2ec28fc2fb..3a67c9e275 100644 --- a/3rdparty/wxWidgets/include/wx/list.h +++ b/3rdparty/wxWidgets/include/wx/list.h @@ -93,7 +93,7 @@ enum wxKeyType #define WX_DECLARE_LIST_WITH_DECL(elT, liT, decl) \ WX_DECLARE_LIST_XO(elT*, liT, decl) -#if !defined( __VISUALC__ ) +#if (defined(_MSC_VER) && _MSC_VER >= 1300) || !defined( __VISUALC__ ) template class WXDLLIMPEXP_BASE wxList_SortFunction @@ -109,8 +109,17 @@ private: #define WX_LIST_SORTFUNCTION( elT, f ) wxList_SortFunction(f) #define VC6_WORKAROUND(elT, liT, decl) +#if defined(_MSC_VER) && _MSC_VER >= 1700 +#define WXObjectAllocator(x) std::_Wrap_alloc< wxObjectAllocator< x > > +#else +#define WXObjectAllocator(x) wxObjectAllocator< x > +#endif + + #else // if defined( __VISUALC__ ) +#define WXObjectAllocator(x) wxObjectAllocator< x > + #define WX_LIST_SORTFUNCTION( elT, f ) std::greater( f ) #define VC6_WORKAROUND(elT, liT, decl) \ decl liT; \ @@ -174,10 +183,10 @@ private: }; \ \ VC6_WORKAROUND(elT, liT, decl) \ - decl liT : public std::list< elT, wxObjectAllocator< elT > > \ + decl liT : public std::list< elT, WXObjectAllocator( elT ) > \ { \ private: \ - typedef std::list< elT, wxObjectAllocator< elT > > BaseListType; \ + typedef std::list< elT, WXObjectAllocator( elT ) > BaseListType; \ static BaseListType EmptyList; \ \ bool m_destroy; \ @@ -187,7 +196,7 @@ private: { \ private: \ /* Workaround for broken VC6 nested class name resolution */ \ - typedef std::list >::iterator iterator; \ + typedef std::list::iterator iterator; \ friend class liT; \ \ iterator m_iter; \ diff --git a/3rdparty/wxWidgets/src/msw/window.cpp b/3rdparty/wxWidgets/src/msw/window.cpp index d30941e7ba..db9adcda64 100644 --- a/3rdparty/wxWidgets/src/msw/window.cpp +++ b/3rdparty/wxWidgets/src/msw/window.cpp @@ -107,8 +107,10 @@ #endif #if !defined __WXWINCE__ && !defined NEED_PBT_H +#if !defined(_MSC_VER) || _MSC_VER < 1600 #include #endif +#endif #if defined(__WXWINCE__) #include "wx/msw/wince/missing.h" diff --git a/common/include/Utilities/wxAppWithHelpers.h b/common/include/Utilities/wxAppWithHelpers.h index cf373db885..ea6a29e99f 100644 --- a/common/include/Utilities/wxAppWithHelpers.h +++ b/common/include/Utilities/wxAppWithHelpers.h @@ -58,7 +58,7 @@ public: }; #ifdef _MSC_VER - typedef std::list< wxEvent*, wxObjectAllocator > wxEventList; + typedef std::list< wxEvent*, WXObjectAllocator(wxEvent*) > wxEventList; #else typedef std::list< wxEvent* > wxEventList; #endif diff --git a/pcsx2/gui/pxEventThread.h b/pcsx2/gui/pxEventThread.h index 8b043c67ce..cfd66f6c5a 100644 --- a/pcsx2/gui/pxEventThread.h +++ b/pcsx2/gui/pxEventThread.h @@ -172,7 +172,7 @@ protected: }; #ifdef _MSC_VER - typedef std::list< SysExecEvent*, wxObjectAllocator > pxEvtList; + typedef std::list< SysExecEvent*, WXObjectAllocator(SysExecEvent*) > pxEvtList; #else typedef std::list pxEvtList; #endif diff --git a/plugins/GSdx/stdafx.h b/plugins/GSdx/stdafx.h index 8d6eb83806..fc60a72c0f 100644 --- a/plugins/GSdx/stdafx.h +++ b/plugins/GSdx/stdafx.h @@ -103,12 +103,16 @@ typedef signed long long int64; using namespace std; -#if defined(_MSC_VER) && _MSC_VER >= 1500 && _MSC_VER < 1600 +#ifdef _MSC_VER +#if _MSC_VER >= 1500 #include - +#if _MSC_VER < 1600 using namespace std::tr1; - +#else + using namespace std; +#endif +#endif #endif #ifdef __GNUC__