Skip to content

Commit 028f734

Browse files
authored
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.
1 parent c987090 commit 028f734

File tree

4 files changed

+15
-19
lines changed

4 files changed

+15
-19
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix stdatomic.h header check for ICC compiler: the ICC implementation lacks
2+
atomic_uintptr_t type which is needed by Python.

configure

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,6 @@ infodir
782782
docdir
783783
oldincludedir
784784
includedir
785-
runstatedir
786785
localstatedir
787786
sharedstatedir
788787
sysconfdir
@@ -896,7 +895,6 @@ datadir='${datarootdir}'
896895
sysconfdir='${prefix}/etc'
897896
sharedstatedir='${prefix}/com'
898897
localstatedir='${prefix}/var'
899-
runstatedir='${localstatedir}/run'
900898
includedir='${prefix}/include'
901899
oldincludedir='/usr/include'
902900
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1149,15 +1147,6 @@ do
11491147
| -silent | --silent | --silen | --sile | --sil)
11501148
silent=yes ;;
11511149

1152-
-runstatedir | --runstatedir | --runstatedi | --runstated \
1153-
| --runstate | --runstat | --runsta | --runst | --runs \
1154-
| --run | --ru | --r)
1155-
ac_prev=runstatedir ;;
1156-
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
1157-
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
1158-
| --run=* | --ru=* | --r=*)
1159-
runstatedir=$ac_optarg ;;
1160-
11611150
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
11621151
ac_prev=sbindir ;;
11631152
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1295,7 +1284,7 @@ fi
12951284
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
12961285
datadir sysconfdir sharedstatedir localstatedir includedir \
12971286
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
1298-
libdir localedir mandir runstatedir
1287+
libdir localedir mandir
12991288
do
13001289
eval ac_val=\$$ac_var
13011290
# Remove trailing slashes.
@@ -1448,7 +1437,6 @@ Fine tuning of the installation directories:
14481437
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
14491438
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
14501439
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
1451-
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
14521440
--libdir=DIR object code libraries [EPREFIX/lib]
14531441
--includedir=DIR C header files [PREFIX/include]
14541442
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -16775,9 +16763,12 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1677516763
1677616764
1677716765
#include <stdatomic.h>
16778-
atomic_int value = ATOMIC_VAR_INIT(1);
16766+
atomic_int int_var;
16767+
atomic_uintptr_t uintptr_var;
1677916768
int main() {
16780-
int loaded_value = atomic_load(&value);
16769+
atomic_store_explicit(&int_var, 5, memory_order_relaxed);
16770+
atomic_store_explicit(&uintptr_var, 0, memory_order_relaxed);
16771+
int loaded_value = atomic_load_explicit(&int_var, memory_order_seq_cst);
1678116772
return 0;
1678216773
}
1678316774

configure.ac

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5414,9 +5414,12 @@ AC_LINK_IFELSE(
54145414
[
54155415
AC_LANG_SOURCE([[
54165416
#include <stdatomic.h>
5417-
atomic_int value = ATOMIC_VAR_INIT(1);
5417+
atomic_int int_var;
5418+
atomic_uintptr_t uintptr_var;
54185419
int main() {
5419-
int loaded_value = atomic_load(&value);
5420+
atomic_store_explicit(&int_var, 5, memory_order_relaxed);
5421+
atomic_store_explicit(&uintptr_var, 0, memory_order_relaxed);
5422+
int loaded_value = atomic_load_explicit(&int_var, memory_order_seq_cst);
54205423
return 0;
54215424
}
54225425
]])
@@ -5426,7 +5429,7 @@ AC_MSG_RESULT($have_stdatomic_h)
54265429

54275430
if test "$have_stdatomic_h" = yes; then
54285431
AC_DEFINE(HAVE_STD_ATOMIC, 1,
5429-
[Has stdatomic.h with atomic_int])
5432+
[Has stdatomic.h with atomic_int and atomic_uintptr_t])
54305433
fi
54315434

54325435
# Check for GCC >= 4.7 __atomic builtins

pyconfig.h.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@
10181018
/* Define to 1 if you have the <stdlib.h> header file. */
10191019
#undef HAVE_STDLIB_H
10201020

1021-
/* Has stdatomic.h with atomic_int */
1021+
/* Has stdatomic.h with atomic_int and atomic_uintptr_t */
10221022
#undef HAVE_STD_ATOMIC
10231023

10241024
/* Define to 1 if you have the `strdup' function. */

0 commit comments

Comments
 (0)