From: Jonathan Wakely Date: Mon, 9 Jan 2017 17:15:58 +0000 (+0000) Subject: PR79017 workaround incomplete C99 math on darwin X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a7765de8ef7653d7e899b24ed7bb3819e5f90f29;p=gcc.git PR79017 workaround incomplete C99 math on darwin PR libstdc++/79017 * acinclude.m4 (GLIBCXX_CHECK_C99_TR1): Check for llrint and llround functions separately on darwin and if they're missing define _GLIBCXX_NO_C99_ROUNDING_FUNCS. * config.h.in: Regenerate. * configure: Regenerate. * include/c_global/cmath [_GLIBCXX_NO_C99_ROUNDING_FUNCS] (llrint) (llrintf, llrintl, llround, llroundf, llroundl): Do not define. From-SVN: r244231 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 4111bae8342..5d9f26d6a9b 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,14 @@ 2017-01-09 Jonathan Wakely + PR libstdc++/79017 + * acinclude.m4 (GLIBCXX_CHECK_C99_TR1): Check for llrint and llround + functions separately on darwin and if they're missing define + _GLIBCXX_NO_C99_ROUNDING_FUNCS. + * config.h.in: Regenerate. + * configure: Regenerate. + * include/c_global/cmath [_GLIBCXX_NO_C99_ROUNDING_FUNCS] (llrint) + (llrintf, llrintl, llround, llroundf, llroundl): Do not define. + * testsuite/30_threads/condition_variable/members/3.cc: Use new macro to detect correct thread_local destructors. * testsuite/util/testsuite_hooks.h (CORRECT_THREAD_LOCAL_DTORS): diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index eef107a7657..4e04ccea2ba 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -1890,12 +1890,14 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [ lgamma(0.0); lgammaf(0.0f); lgammal(0.0l); + #ifndef __APPLE__ /* see below */ llrint(0.0); llrintf(0.0f); llrintl(0.0l); llround(0.0); llroundf(0.0f); llroundl(0.0l); + #endif log1p(0.0); log1pf(0.0f); log1pl(0.0l); @@ -1954,6 +1956,29 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [ AC_DEFINE(_GLIBCXX_USE_C99_MATH_TR1, 1, [Define if C99 functions or macros in should be imported in in namespace std::tr1.]) + + case "${target_os}" in + darwin*) + AC_MSG_CHECKING([for ISO C99 rounding functions in ]) + AC_CACHE_VAL(glibcxx_cv_c99_math_llround, [ + AC_TRY_COMPILE([#include ], + [llrint(0.0); + llrintf(0.0f); + llrintl(0.0l); + llround(0.0); + llroundf(0.0f); + llroundl(0.0l); + ], + [glibcxx_cv_c99_math_llround=yes], + [glibcxx_cv_c99_math_llround=no]) + ]) + AC_MSG_RESULT($glibcxx_cv_c99_math_llround) + ;; + esac + if test x"$glibcxx_cv_c99_math_llround" = x"no"; then + AC_DEFINE(_GLIBCXX_NO_C99_ROUNDING_FUNCS, 1, + [Define if C99 llrint and llround functions are missing from .]) + fi fi # Check for the existence of functions (NB: doesn't make diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index cdd313bef6a..51b770dd1dd 100644 --- a/libstdc++-v3/config.h.in +++ b/libstdc++-v3/config.h.in @@ -819,6 +819,9 @@ /* Define to the letter to which size_t is mangled. */ #undef _GLIBCXX_MANGLE_SIZE_T +/* Define if C99 llrint and llround functions are missing from . */ +#undef _GLIBCXX_NO_C99_ROUNDING_FUNCS + /* Define if ptrdiff_t is int. */ #undef _GLIBCXX_PTRDIFF_T_IS_INT diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index c7f679a2f2a..64d893344b8 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -20079,12 +20079,14 @@ typedef double_t my_double_t; lgamma(0.0); lgammaf(0.0f); lgammal(0.0l); + #ifndef __APPLE__ /* see below */ llrint(0.0); llrintf(0.0f); llrintl(0.0l); llround(0.0); llroundf(0.0f); llroundl(0.0l); + #endif log1p(0.0); log1pf(0.0f); log1pl(0.0l); @@ -20156,6 +20158,50 @@ $as_echo "$glibcxx_cv_c99_math_tr1" >&6; } $as_echo "#define _GLIBCXX_USE_C99_MATH_TR1 1" >>confdefs.h + + case "${target_os}" in + darwin*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 rounding functions in " >&5 +$as_echo_n "checking for ISO C99 rounding functions in ... " >&6; } + if test "${glibcxx_cv_c99_math_llround+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +llrint(0.0); + llrintf(0.0f); + llrintl(0.0l); + llround(0.0); + llroundf(0.0f); + llroundl(0.0l); + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + glibcxx_cv_c99_math_llround=yes +else + glibcxx_cv_c99_math_llround=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_c99_math_llround" >&5 +$as_echo "$glibcxx_cv_c99_math_llround" >&6; } + ;; + esac + if test x"$glibcxx_cv_c99_math_llround" = x"no"; then + +$as_echo "#define _GLIBCXX_NO_C99_ROUNDING_FUNCS 1" >>confdefs.h + + fi fi # Check for the existence of functions (NB: doesn't make diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath index 3630a5b16d3..6e7508f6939 100644 --- a/libstdc++-v3/include/c_global/cmath +++ b/libstdc++-v3/include/c_global/cmath @@ -1012,12 +1012,14 @@ _GLIBCXX_END_NAMESPACE_VERSION #undef lgamma #undef lgammaf #undef lgammal +#ifndef _GLIBCXX_NO_C99_ROUNDING_FUNCS #undef llrint #undef llrintf #undef llrintl #undef llround #undef llroundf #undef llroundl +#endif #undef log1p #undef log1pf #undef log1pl @@ -1143,6 +1145,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION using ::lgammaf; using ::lgammal; +#ifndef _GLIBCXX_NO_C99_ROUNDING_FUNCS using ::llrint; using ::llrintf; using ::llrintl; @@ -1150,6 +1153,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION using ::llround; using ::llroundf; using ::llroundl; +#endif using ::log1p; using ::log1pf;