Fix issue with C++ & G++ 4.9
This commit is contained in:
1 parent
75e7cdf3b2
commit
a8f124ed9b
1 file changed
+7
-4
+7
-4
@@ -29,8 +29,11 @@
|
|||||||
it is hard to use this header directly with a C++ compiler like
|
it is hard to use this header directly with a C++ compiler like
|
||||||
g++ or MSVC.
|
g++ or MSVC.
|
||||||
(See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60932 ).
|
(See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60932 ).
|
||||||
clang has no issue with this header.*/
|
clang has no issue with this header.
|
||||||
#if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__clang__)
|
GCC 4.9 doesn't have a working implementation of 'atomic'
|
||||||
|
*/
|
||||||
|
#if defined(__cplusplus) && __cplusplus >= 201103L \
|
||||||
|
&& !defined(__clang__) && !(defined(__GNUC__) && __GNUC__ < 5)
|
||||||
|
|
||||||
/* NOTE: This is what the stdatomic.h header shall do in C++ mode. */
|
/* NOTE: This is what the stdatomic.h header shall do in C++ mode. */
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
@@ -89,7 +92,7 @@ using std::atomic_flag_clear_explicit;
|
|||||||
#define _Atomic(T) std::atomic< T >
|
#define _Atomic(T) std::atomic< T >
|
||||||
|
|
||||||
#elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) \
|
#elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) \
|
||||||
|| ( defined(__GNUC__) && !defined(__clang__) ) \
|
|| ( defined(__GNUC__) && !defined(__clang__) && !defined(__cplusplus)) \
|
||||||
|| (defined(__clang__) && __clang_major__ >= 4)
|
|| (defined(__clang__) && __clang_major__ >= 4)
|
||||||
|
|
||||||
/* CLANG 3.5 has issues with GCC's stdatomic.h
|
/* CLANG 3.5 has issues with GCC's stdatomic.h
|
||||||
@@ -98,7 +101,7 @@ using std::atomic_flag_clear_explicit;
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* No atomic.h, nor stdatomic.h
|
/* No working atomic.h, nor working stdatomic.h
|
||||||
Write a compatible slin layer using mutex. */
|
Write a compatible slin layer using mutex. */
|
||||||
#include "m-mutex.h"
|
#include "m-mutex.h"
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user