summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Skeleton (bot) <31488909+miss-islington@users.noreply.github.com>2019-10-22 13:17:21 -0700
committerGitHub <noreply@github.com>2019-10-22 13:17:21 -0700
commitb102e4f05278c1b06130885eba961bd0193733b4 (patch)
treecd700163ab84bbd2b1426a16fa6f8c4137ea804b
parentd4dc4a58f5c124463308701c3aba985c1fe5cc0e (diff)
downloadcpython-git-b102e4f05278c1b06130885eba961bd0193733b4.tar.gz
bpo-37415: Fix stdatomic.h header check for ICC compiler (GH-16717)
Fix stdatomic.h header check for ICC compiler: the ICC implementation lacks atomic_uintptr_t type which is needed by Python. Test: * atomic_int and atomic_uintptr_t types * atomic_load_explicit() and atomic_store_explicit() * memory_order_relaxed and memory_order_seq_cst constants But don't test ATOMIC_VAR_INIT(): it's not used in Python. (cherry picked from commit 028f7349a0f6eaea0fec31becb587fcdf6e3cb28) Co-authored-by: Victor Stinner <vstinner@python.org>
-rw-r--r--Misc/NEWS.d/next/Build/2019-10-11-15-32-58.bpo-37415.D9RXrq.rst2
-rwxr-xr-xconfigure7
-rw-r--r--configure.ac9
-rw-r--r--pyconfig.h.in2
4 files changed, 14 insertions, 6 deletions
diff --git a/Misc/NEWS.d/next/Build/2019-10-11-15-32-58.bpo-37415.D9RXrq.rst b/Misc/NEWS.d/next/Build/2019-10-11-15-32-58.bpo-37415.D9RXrq.rst
new file mode 100644
index 0000000000..98f4a3bf4f
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2019-10-11-15-32-58.bpo-37415.D9RXrq.rst
@@ -0,0 +1,2 @@
+Fix stdatomic.h header check for ICC compiler: the ICC implementation lacks
+atomic_uintptr_t type which is needed by Python.
diff --git a/configure b/configure
index 0f466db4aa..b769d59629 100755
--- a/configure
+++ b/configure
@@ -16849,9 +16849,12 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#include <stdatomic.h>
- atomic_int value = ATOMIC_VAR_INIT(1);
+ atomic_int int_var;
+ atomic_uintptr_t uintptr_var;
int main() {
- int loaded_value = atomic_load(&value);
+ atomic_store_explicit(&int_var, 5, memory_order_relaxed);
+ atomic_store_explicit(&uintptr_var, 0, memory_order_relaxed);
+ int loaded_value = atomic_load_explicit(&int_var, memory_order_seq_cst);
return 0;
}
diff --git a/configure.ac b/configure.ac
index 1ef0df70e6..49acff3136 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5492,9 +5492,12 @@ AC_LINK_IFELSE(
[
AC_LANG_SOURCE([[
#include <stdatomic.h>
- atomic_int value = ATOMIC_VAR_INIT(1);
+ atomic_int int_var;
+ atomic_uintptr_t uintptr_var;
int main() {
- int loaded_value = atomic_load(&value);
+ atomic_store_explicit(&int_var, 5, memory_order_relaxed);
+ atomic_store_explicit(&uintptr_var, 0, memory_order_relaxed);
+ int loaded_value = atomic_load_explicit(&int_var, memory_order_seq_cst);
return 0;
}
]])
@@ -5504,7 +5507,7 @@ AC_MSG_RESULT($have_stdatomic_h)
if test "$have_stdatomic_h" = yes; then
AC_DEFINE(HAVE_STD_ATOMIC, 1,
- [Has stdatomic.h with atomic_int])
+ [Has stdatomic.h with atomic_int and atomic_uintptr_t])
fi
# Check for GCC >= 4.7 __atomic builtins
diff --git a/pyconfig.h.in b/pyconfig.h.in
index d36fc933f4..f4816fdcdf 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -963,7 +963,7 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
-/* Has stdatomic.h with atomic_int */
+/* Has stdatomic.h with atomic_int and atomic_uintptr_t */
#undef HAVE_STD_ATOMIC
/* Define to 1 if you have the `strdup' function. */