From: Andy Heninger <andy.heninger@gmail.com> Date: Tue, 14 Aug 2018 01:25:05 +0000 (-0700) Subject: ICU-12505 U_HAVE_STD_ATOMICS, reduce & simplify configure options. (#52) X-Git-Tag: release-63-rc~121 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0a1513bcc931477a9c7e4feed040393f571996a5;p=icu ICU-12505 U_HAVE_STD_ATOMICS, reduce & simplify configure options. (#52) --- diff --git a/icu4c/source/common/putilimp.h b/icu4c/source/common/putilimp.h index 8b858df9e3b..c43302d16c4 100644 --- a/icu4c/source/common/putilimp.h +++ b/icu4c/source/common/putilimp.h @@ -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. diff --git a/icu4c/source/configure b/icu4c/source/configure index a54a2291a3d..897ce589373 100755 --- a/icu4c/source/configure +++ b/icu4c/source/configure @@ -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 @@ -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' diff --git a/icu4c/source/configure.ac b/icu4c/source/configure.ac index 1f42887356e..747b583e981 100644 --- a/icu4c/source/configure.ac +++ b/icu4c/source/configure.ac @@ -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.