Skip to content

Commit

Permalink
Issue python#22038, configure: HAVE_STD_ATOMIC now also check that "a…
Browse files Browse the repository at this point in the history
…tomic_int" and

"_Atomic void*" types work. Change needed on FreeBSD 10 where stdatomic.h is
available but the compiler fails on "_Atomic void*" with "_Atomic cannot be
applied to incomplete type 'void'".
  • Loading branch information
vstinner committed Jan 14, 2015
1 parent 3be472b commit 923e06f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -15711,7 +15711,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#include <stdatomic.h>
_Atomic int value = ATOMIC_VAR_INIT(1);
atomic_int value = ATOMIC_VAR_INIT(1);
_Atomic void *py_atomic_address = (void*) &value;
int main() {
int loaded_value = atomic_load(&value);
return 0;
Expand Down
6 changes: 4 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4890,7 +4890,8 @@ AC_LINK_IFELSE(
[
AC_LANG_SOURCE([[
#include <stdatomic.h>
_Atomic int value = ATOMIC_VAR_INIT(1);
atomic_int value = ATOMIC_VAR_INIT(1);
_Atomic void *py_atomic_address = (void*) &value;
int main() {
int loaded_value = atomic_load(&value);
return 0;
Expand All @@ -4901,7 +4902,8 @@ AC_LINK_IFELSE(
AC_MSG_RESULT($have_stdatomic_h)

if test "$have_stdatomic_h" = yes; then
AC_DEFINE(HAVE_STD_ATOMIC, 1, [Has stdatomic.h])
AC_DEFINE(HAVE_STD_ATOMIC, 1,
[Has stdatomic.h, atomic_int and _Atomic void* types work])
fi

# Check for GCC >= 4.7 __atomic builtins
Expand Down
2 changes: 1 addition & 1 deletion pyconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H

/* Has stdatomic.h */
/* Has stdatomic.h, atomic_int and _Atomic void* types work */
#undef HAVE_STD_ATOMIC

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

0 comments on commit 923e06f

Please sign in to comment.