aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-04-21 16:58:55 -0700
committerChris Robinson <[email protected]>2017-04-21 16:58:55 -0700
commita0a41921fc28a1ff76a5850936cb32e912887735 (patch)
tree423c01d929f955e4f12c8188036507d6b88c294d /CMakeLists.txt
parentd85177cd3e687f19e080fde68642d1f7e080f129 (diff)
Remove const from _Atomic vars to make Clang happy
Clang does not allow using C11's atomic_load on const _Atomic variables. Previously it just disabled use of C11 atomics if atomic_load didn't work on a const _Atomic variable, but I think I'd prefer to have Clang use C11 atomics for the added features (more explicit memory ordering) even if it means a few instances of breaking const.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt7
1 files changed, 3 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3cb1e5f5..ac1133d4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -264,12 +264,11 @@ HAVE_C11_ALIGNAS)
# Check if we have C11 _Atomic
CHECK_C_SOURCE_COMPILES(
"#include <stdatomic.h>
- const int _Atomic foo = ATOMIC_VAR_INIT(~0);
- int _Atomic bar = ATOMIC_VAR_INIT(0);
+ int _Atomic foo = ATOMIC_VAR_INIT(0);
int main()
{
- atomic_fetch_add(&bar, 2);
- return atomic_load(&foo);
+ atomic_fetch_add(&foo, 2);
+ return 0;
}"
HAVE_C11_ATOMIC)