Skip to content

Commit

Permalink
ICU-12505 U_HAVE_STD_ATOMICS, reduce & simplify configure options. (u…
Browse files Browse the repository at this point in the history
  • Loading branch information
aheninger authored Aug 14, 2018
1 parent 2ab00ac commit 8587900
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 63 deletions.
24 changes: 6 additions & 18 deletions icu4c/source/common/putilimp.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,30 +204,18 @@ typedef size_t uintptr_t;

/**
* \def U_HAVE_STD_ATOMICS
* Defines whether the standard C++11 <atomic> is available.
* ICU will use this when available,
* otherwise will fall back to compiler or platform specific alternatives.
* Defines whether to use the standard C++11 <atomic> functions
* If false, ICU will fall back to compiler or platform specific alternatives.
* Note: support for these fall back options for atomics will be removed in a future version
* of ICU, and the use of C++ 11 atomics will be required.
* @internal
*/
#ifdef U_HAVE_STD_ATOMICS
/* Use the predefined value. */
#elif U_CPLUSPLUS_VERSION < 11
/* Not C++11, disable use of atomics */
# define U_HAVE_STD_ATOMICS 0
#elif __clang__ && __clang_major__==3 && __clang_minor__<=1
/* Clang 3.1, has atomic variable initializer bug. */
# define U_HAVE_STD_ATOMICS 0
#else
/* U_HAVE_ATOMIC is typically set by an autoconf test of #include <atomic> */
/* Can be set manually, or left undefined, on platforms without autoconf. */
# if defined(U_HAVE_ATOMIC) && U_HAVE_ATOMIC
# define U_HAVE_STD_ATOMICS 1
# else
# define U_HAVE_STD_ATOMICS 0
# endif
#else
# define U_HAVE_STD_ATOMICS 1
#endif


/**
* \def U_HAVE_CLANG_ATOMICS
* Defines whether Clang c11 style built-in atomics are available.
Expand Down
32 changes: 0 additions & 32 deletions icu4c/source/configure
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,6 @@ U_HAVE_INTTYPES_H
GENCCODE_ASSEMBLY
HAVE_MMAP
LIB_THREAD
U_HAVE_ATOMIC
ENABLE_RPATH
U_ENABLE_DYLOAD
U_HAVE_PLUGINS
Expand Down Expand Up @@ -6059,37 +6058,6 @@ $as_echo "$as_me: Adding CXXFLAGS option -std=c++11" >&6;}
fi
fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if #include <atomic> works" >&5
$as_echo_n "checking if #include <atomic> works... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <atomic>
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
ac_cv_header_atomic=yes
else
ac_cv_header_atomic=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_atomic" >&5
$as_echo "$ac_cv_header_atomic" >&6; }
if test $ac_cv_header_atomic = yes
then
U_HAVE_ATOMIC=1
else
U_HAVE_ATOMIC=0
fi
# Make this available via CPPFLAGS
CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_ATOMIC=${U_HAVE_ATOMIC}"


ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
Expand Down
13 changes: 0 additions & 13 deletions icu4c/source/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -527,19 +527,6 @@ if [[ "$GXX" = yes ]]; then
fi
fi

AC_MSG_CHECKING([[if #include <atomic> works]])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <atomic>]], [[]])], [ac_cv_header_atomic=yes], [ac_cv_header_atomic=no])
AC_MSG_RESULT($ac_cv_header_atomic)
if test $ac_cv_header_atomic = yes
then
U_HAVE_ATOMIC=1
else
U_HAVE_ATOMIC=0
fi
# Make this available via CPPFLAGS
CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_ATOMIC=${U_HAVE_ATOMIC}"
AC_SUBST(U_HAVE_ATOMIC)

AC_LANG_POP([C++])

# Always build ICU with multi-threading support.
Expand Down

0 comments on commit 8587900

Please sign in to comment.