diff options
Diffstat (limited to 'configure.cmake')
-rw-r--r-- | configure.cmake | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/configure.cmake b/configure.cmake index db8742bb93b..cbcdab5e4f9 100644 --- a/configure.cmake +++ b/configure.cmake @@ -891,9 +891,16 @@ HAVE_GCC_ATOMIC_BUILTINS) CHECK_CXX_SOURCE_COMPILES(" int main() { - long long int var= 1; - long long int *ptr= &var; - return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST); + char x=1; + short y=1; + int z=1; + long w = 1; + long long s = 1; + x = __atomic_add_fetch(&x, 1, __ATOMIC_SEQ_CST); + y = __atomic_add_fetch(&y, 1, __ATOMIC_SEQ_CST); + z = __atomic_add_fetch(&z, 1, __ATOMIC_SEQ_CST); + w = __atomic_add_fetch(&w, 1, __ATOMIC_SEQ_CST); + return (int)__atomic_load_n(&s, __ATOMIC_SEQ_CST); }" HAVE_GCC_C11_ATOMICS_WITHOUT_LIBATOMIC) IF (HAVE_GCC_C11_ATOMICS_WITHOUT_LIBATOMIC) @@ -904,9 +911,16 @@ ELSE() CHECK_CXX_SOURCE_COMPILES(" int main() { - long long int var= 1; - long long int *ptr= &var; - return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST); + char x=1; + short y=1; + int z=1; + long w = 1; + long long s = 1; + x = __atomic_add_fetch(&x, 1, __ATOMIC_SEQ_CST); + y = __atomic_add_fetch(&y, 1, __ATOMIC_SEQ_CST); + z = __atomic_add_fetch(&z, 1, __ATOMIC_SEQ_CST); + w = __atomic_add_fetch(&w, 1, __ATOMIC_SEQ_CST); + return (int)__atomic_load_n(&s, __ATOMIC_SEQ_CST); }" HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC) IF(HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC) |