diff options
author | Andrew Galante <[email protected]> | 2018-06-11 15:03:36 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2018-06-13 10:09:46 -0700 |
commit | 9d547a7617fbcbc29f75ed85ff774807ddca5ce0 (patch) | |
tree | 6b0535f8dacc10e73fbbea7c469fc193289a5336 | |
parent | b29b5a82a17e845e73ebef845176d9d1f44a2d00 (diff) |
meson: Test for __atomic_add_fetch in atomic checks
Some platforms have 64-bit __atomic_load_n but not 64-bit
__atomic_add_fetch, so test for both of them.
Bug: https://bugs.gentoo.org/655616
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]>
Reviewed-by: Dylan Baker <[email protected]>
-rw-r--r-- | meson.build | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/meson.build b/meson.build index 375751bce10..22e7a6d6cda 100644 --- a/meson.build +++ b/meson.build @@ -835,7 +835,9 @@ if cc.compiles('''#include <stdint.h> struct { uint64_t *v; } x; - return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE); + return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) & + (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL); + }''', name : 'GCC atomic builtins') pre_args += '-DUSE_GCC_ATOMIC_BUILTINS' @@ -851,7 +853,8 @@ if cc.compiles('''#include <stdint.h> struct { uint64_t *v; } x; - return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE); + return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) & + (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL); }''', name : 'GCC atomic builtins required -latomic') dep_atomic = cc.find_library('atomic') |