summaryrefslogtreecommitdiff
path: root/Source/Core/Common
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/Common
parent58159a1693ebb9b33b6e1b97a83a2f58f0046623 (diff)
parent4d27315cd1c0de85df93bfa859d19741483c06ea (diff)
Merge branch 'osx-libcxx'
Diffstat (limited to 'Source/Core/Common')
-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
5 files changed, 34 insertions, 3 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"