Skip to content
Snippets Groups Projects
Commit 61c0a8b2 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Don't try to use atomics for GCC versions < 4.9

Apparently GNU forgot to include stdatomic.h in GCC 4.8.
For Altere and his CentOS 7 system.
parent 160606e4
Branches
Tags
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #1395 failed
...@@ -217,7 +217,7 @@ int DLLCALL pthread_mutex_destroy(pthread_mutex_t* mutex) ...@@ -217,7 +217,7 @@ int DLLCALL pthread_mutex_destroy(pthread_mutex_t* mutex)
/* Protected (thread-safe) Integers (e.g. atomic/interlocked variables) */ /* Protected (thread-safe) Integers (e.g. atomic/interlocked variables) */
/************************************************************************/ /************************************************************************/
#ifndef __unix__ #if __STDC_NO_ATOMICS__
void DLLCALL protected_int32_init(protected_int32_t* prot, int32_t value) void DLLCALL protected_int32_init(protected_int32_t* prot, int32_t value)
{ {
prot->value = value; prot->value = value;
......
...@@ -40,7 +40,14 @@ ...@@ -40,7 +40,14 @@
#include "gen_defs.h" /* HANDLE */ #include "gen_defs.h" /* HANDLE */
#include "wrapdll.h" /* DLLEXPORT and DLLCALL */ #include "wrapdll.h" /* DLLEXPORT and DLLCALL */
#ifdef __unix__ #if !__STDC_NO_ATOMICS__
#if defined __GNUC__ && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9))
#define __STDC_NO_ATOMICS__ 1
#elif defined __BORLANDC__
#define __STDC_NO_ATOMICS__ 1
#endif
#endif
#if !__STDC_NO_ATOMICS__
#include <stdbool.h> #include <stdbool.h>
#ifdef __cplusplus #ifdef __cplusplus
#include <atomic> #include <atomic>
...@@ -157,7 +164,7 @@ DLLEXPORT int DLLCALL pthread_once(pthread_once_t *oc, void (*init)(void)); ...@@ -157,7 +164,7 @@ DLLEXPORT int DLLCALL pthread_once(pthread_once_t *oc, void (*init)(void));
/* working and being thread-safe on all platforms that support pthread */ /* working and being thread-safe on all platforms that support pthread */
/* mutexes. */ /* mutexes. */
/************************************************************************/ /************************************************************************/
#ifdef __unix__ #if !__STDC_NO_ATOMICS__
#ifdef __cplusplus #ifdef __cplusplus
typedef std::atomic<int32_t> protected_int32_t; typedef std::atomic<int32_t> protected_int32_t;
typedef std::atomic<uint32_t> protected_uint32_t; typedef std::atomic<uint32_t> protected_uint32_t;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment