summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2013-04-01 18:17:49 +0200
committerPierre Bourdon <delroth@gmail.com>2013-04-01 18:17:49 +0200
commit49d809ac0edd21f77ea6203481bfa680a72b9aa2 (patch)
treebbf8bed504bfb6762a579741b824fd0eb0d0af8d /Source/Core
parent58159a1693ebb9b33b6e1b97a83a2f58f0046623 (diff)
parent4d27315cd1c0de85df93bfa859d19741483c06ea (diff)
Merge branch 'osx-libcxx'
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/Src/LogManager.h2
-rw-r--r--Source/Core/Common/Src/StdConditionVariable.h17
-rw-r--r--Source/Core/Common/Src/StdMutex.h7
-rw-r--r--Source/Core/Common/Src/StdThread.h7
-rw-r--r--Source/Core/Common/Src/Thread.h4
-rw-r--r--Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.h6
-rw-r--r--Source/Core/DolphinWX/Src/ConfigMain.cpp11
7 files changed, 39 insertions, 15 deletions
diff --git a/Source/Core/Common/Src/LogManager.h b/Source/Core/Common/Src/LogManager.h
index f7ccb15034..9c3855982e 100644
--- a/Source/Core/Common/Src/LogManager.h
+++ b/Source/Core/Common/Src/LogManager.h
@@ -46,7 +46,7 @@ public:
void Log(LogTypes::LOG_LEVELS, const char *msg);
- bool IsValid() { return (m_logfile != NULL); }
+ bool IsValid() { return (bool)m_logfile; }
bool IsEnabled() const { return m_enable; }
void SetEnable(bool enable) { m_enable = enable; }
diff --git a/Source/Core/Common/Src/StdConditionVariable.h b/Source/Core/Common/Src/StdConditionVariable.h
index 6530712c8f..85875fef10 100644
--- a/Source/Core/Common/Src/StdConditionVariable.h
+++ b/Source/Core/Common/Src/StdConditionVariable.h
@@ -5,9 +5,26 @@
#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
+#ifndef __has_include
+#define __has_include(s) 0
+#endif
+
#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ && !ANDROID
+
// GCC 4.4 provides <condition_variable>
#include <condition_variable>
+
+#elif __has_include(<condition_variable>)
+
+// clang and libc++ provide <condition_variable> on OSX. However, the version
+// of libc++ bundled with OSX 10.7 and 10.8 is buggy: it uses _ as a variable.
+//
+// We work around this issue by undefining and redefining _.
+
+#undef _
+#include <condition_variable>
+#define _(s) wxGetTranslation((s))
+
#else
// partial std::condition_variable implementation for win32/pthread
diff --git a/Source/Core/Common/Src/StdMutex.h b/Source/Core/Common/Src/StdMutex.h
index 8a5d22f928..a20c7f744a 100644
--- a/Source/Core/Common/Src/StdMutex.h
+++ b/Source/Core/Common/Src/StdMutex.h
@@ -5,9 +5,16 @@
#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
+#ifndef __has_include
+#define __has_include(s) 0
+#endif
+
#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ && !ANDROID
// GCC 4.4 provides <mutex>
#include <mutex>
+#elif __has_include(<mutex>)
+// Clang + libc++
+#include <mutex>
#else
// partial <mutex> implementation for win32/pthread
diff --git a/Source/Core/Common/Src/StdThread.h b/Source/Core/Common/Src/StdThread.h
index 8893c36204..19dfd60c37 100644
--- a/Source/Core/Common/Src/StdThread.h
+++ b/Source/Core/Common/Src/StdThread.h
@@ -5,12 +5,19 @@
#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
+#ifndef __has_include
+#define __has_include(s) 0
+#endif
+
#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ && !ANDROID
// GCC 4.4 provides <thread>
#ifndef _GLIBCXX_USE_SCHED_YIELD
#define _GLIBCXX_USE_SCHED_YIELD
#endif
#include <thread>
+#elif __has_include(<thread>)
+// Clang + libc++
+#include <thread>
#else
// partial std::thread implementation for win32/pthread
diff --git a/Source/Core/Common/Src/Thread.h b/Source/Core/Common/Src/Thread.h
index b5f899c43b..e35e73dbe9 100644
--- a/Source/Core/Common/Src/Thread.h
+++ b/Source/Core/Common/Src/Thread.h
@@ -18,9 +18,9 @@
#ifndef _THREAD_H_
#define _THREAD_H_
-#include "StdThread.h"
-#include "StdMutex.h"
#include "StdConditionVariable.h"
+#include "StdMutex.h"
+#include "StdThread.h"
// Don't include common.h here as it will break LogManager
#include "CommonTypes.h"
diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.h b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.h
index 8fd2a2af5f..40466a81dd 100644
--- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.h
+++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.h
@@ -75,7 +75,7 @@ public:
virtual void DoState(PointerWrap& p);
// Needed because StdThread.h std::thread implem does not support member
- // pointers.
+ // pointers. TODO(delroth): obsolete.
static void SpawnAXThread(CUCode_AX* self);
protected:
@@ -107,13 +107,13 @@ protected:
volatile u16 m_cmdlist[512];
volatile u32 m_cmdlist_size;
- std::thread m_axthread;
-
// Sync objects
std::mutex m_processing;
std::condition_variable m_cmdlist_cv;
std::mutex m_cmdlist_mutex;
+ std::thread m_axthread;
+
// Copy a command list from memory to our temp buffer
void CopyCmdList(u32 addr, u16 size);
diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp
index 85fe8d0225..4272d9ef90 100644
--- a/Source/Core/DolphinWX/Src/ConfigMain.cpp
+++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp
@@ -18,6 +18,7 @@
#include <string> // System
#include <vector>
#include <algorithm>
+#include <functional>
#include <wx/spinbutt.h>
#include "Common.h"
@@ -43,14 +44,6 @@
#include "Main.h"
#include "VideoBackendBase.h"
-#if defined(__APPLE__)
-#include <tr1/functional>
-using std::tr1::function;
-#else
-#include <functional>
-using std::function;
-#endif
-
#define TEXT_BOX(page, text) new wxStaticText(page, wxID_ANY, text, wxDefaultPosition, wxDefaultSize)
struct CPUCore
@@ -631,7 +624,7 @@ void CConfigMain::CreateGUIControls()
theme_selection->SetStringSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name);
// std::function = avoid error on msvc
- theme_selection->Bind(wxEVT_COMMAND_CHOICE_SELECTED, function<void(wxEvent&)>([theme_selection](wxEvent&)
+ theme_selection->Bind(wxEVT_COMMAND_CHOICE_SELECTED, std::function<void(wxEvent&)>([theme_selection](wxEvent&)
{
SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name = theme_selection->GetStringSelection();
main_frame->InitBitmaps();