bpo-39465: Add pycore_atomic_funcs.h header (GH-20766)
Add pycore_atomic_funcs.h internal header file: similar to
pycore_atomic.h but don't require to declare variables as atomic.
Add _Py_atomic_size_get() and _Py_atomic_size_set() functions.
diff --git a/configure.ac b/configure.ac
index ee5573c..39eadfe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5586,14 +5586,15 @@
[Has stdatomic.h with atomic_int and atomic_uintptr_t])
fi
-# Check for GCC >= 4.7 __atomic builtins
-AC_MSG_CHECKING(for GCC >= 4.7 __atomic builtins)
+# Check for GCC >= 4.7 and clang __atomic builtin functions
+AC_MSG_CHECKING(for builtin __atomic_load_n and __atomic_store_n functions)
AC_LINK_IFELSE(
[
AC_LANG_SOURCE([[
- volatile int val = 1;
+ int val;
int main() {
- __atomic_load_n(&val, __ATOMIC_SEQ_CST);
+ __atomic_store_n(&val, 1, __ATOMIC_SEQ_CST);
+ (void)__atomic_load_n(&val, __ATOMIC_SEQ_CST);
return 0;
}
]])
@@ -5602,7 +5603,7 @@
AC_MSG_RESULT($have_builtin_atomic)
if test "$have_builtin_atomic" = yes; then
- AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Has builtin atomics])
+ AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Has builtin __atomic_load_n() and __atomic_store_n() functions])
fi
# ensurepip option