Commit a7765de8 by Jonathan Wakely Committed by Jonathan Wakely

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
parent 4b85f4e6
2017-01-09 Jonathan Wakely <jwakely@redhat.com> 2017-01-09 Jonathan Wakely <jwakely@redhat.com>
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 * testsuite/30_threads/condition_variable/members/3.cc: Use new macro
to detect correct thread_local destructors. to detect correct thread_local destructors.
* testsuite/util/testsuite_hooks.h (CORRECT_THREAD_LOCAL_DTORS): * testsuite/util/testsuite_hooks.h (CORRECT_THREAD_LOCAL_DTORS):
......
...@@ -1890,12 +1890,14 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [ ...@@ -1890,12 +1890,14 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [
lgamma(0.0); lgamma(0.0);
lgammaf(0.0f); lgammaf(0.0f);
lgammal(0.0l); lgammal(0.0l);
#ifndef __APPLE__ /* see below */
llrint(0.0); llrint(0.0);
llrintf(0.0f); llrintf(0.0f);
llrintl(0.0l); llrintl(0.0l);
llround(0.0); llround(0.0);
llroundf(0.0f); llroundf(0.0f);
llroundl(0.0l); llroundl(0.0l);
#endif
log1p(0.0); log1p(0.0);
log1pf(0.0f); log1pf(0.0f);
log1pl(0.0l); log1pl(0.0l);
...@@ -1954,6 +1956,29 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [ ...@@ -1954,6 +1956,29 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [
AC_DEFINE(_GLIBCXX_USE_C99_MATH_TR1, 1, AC_DEFINE(_GLIBCXX_USE_C99_MATH_TR1, 1,
[Define if C99 functions or macros in <math.h> should be imported [Define if C99 functions or macros in <math.h> should be imported
in <tr1/cmath> in namespace std::tr1.]) in <tr1/cmath> in namespace std::tr1.])
case "${target_os}" in
darwin*)
AC_MSG_CHECKING([for ISO C99 rounding functions in <math.h>])
AC_CACHE_VAL(glibcxx_cv_c99_math_llround, [
AC_TRY_COMPILE([#include <math.h>],
[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 <math.h>.])
fi
fi fi
# Check for the existence of <inttypes.h> functions (NB: doesn't make # Check for the existence of <inttypes.h> functions (NB: doesn't make
......
...@@ -819,6 +819,9 @@ ...@@ -819,6 +819,9 @@
/* Define to the letter to which size_t is mangled. */ /* Define to the letter to which size_t is mangled. */
#undef _GLIBCXX_MANGLE_SIZE_T #undef _GLIBCXX_MANGLE_SIZE_T
/* Define if C99 llrint and llround functions are missing from <math.h>. */
#undef _GLIBCXX_NO_C99_ROUNDING_FUNCS
/* Define if ptrdiff_t is int. */ /* Define if ptrdiff_t is int. */
#undef _GLIBCXX_PTRDIFF_T_IS_INT #undef _GLIBCXX_PTRDIFF_T_IS_INT
......
...@@ -20079,12 +20079,14 @@ typedef double_t my_double_t; ...@@ -20079,12 +20079,14 @@ typedef double_t my_double_t;
lgamma(0.0); lgamma(0.0);
lgammaf(0.0f); lgammaf(0.0f);
lgammal(0.0l); lgammal(0.0l);
#ifndef __APPLE__ /* see below */
llrint(0.0); llrint(0.0);
llrintf(0.0f); llrintf(0.0f);
llrintl(0.0l); llrintl(0.0l);
llround(0.0); llround(0.0);
llroundf(0.0f); llroundf(0.0f);
llroundl(0.0l); llroundl(0.0l);
#endif
log1p(0.0); log1p(0.0);
log1pf(0.0f); log1pf(0.0f);
log1pl(0.0l); log1pl(0.0l);
...@@ -20156,6 +20158,50 @@ $as_echo "$glibcxx_cv_c99_math_tr1" >&6; } ...@@ -20156,6 +20158,50 @@ $as_echo "$glibcxx_cv_c99_math_tr1" >&6; }
$as_echo "#define _GLIBCXX_USE_C99_MATH_TR1 1" >>confdefs.h $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 <math.h>" >&5
$as_echo_n "checking for ISO C99 rounding functions in <math.h>... " >&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 <math.h>
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 fi
# Check for the existence of <inttypes.h> functions (NB: doesn't make # Check for the existence of <inttypes.h> functions (NB: doesn't make
...@@ -1012,12 +1012,14 @@ _GLIBCXX_END_NAMESPACE_VERSION ...@@ -1012,12 +1012,14 @@ _GLIBCXX_END_NAMESPACE_VERSION
#undef lgamma #undef lgamma
#undef lgammaf #undef lgammaf
#undef lgammal #undef lgammal
#ifndef _GLIBCXX_NO_C99_ROUNDING_FUNCS
#undef llrint #undef llrint
#undef llrintf #undef llrintf
#undef llrintl #undef llrintl
#undef llround #undef llround
#undef llroundf #undef llroundf
#undef llroundl #undef llroundl
#endif
#undef log1p #undef log1p
#undef log1pf #undef log1pf
#undef log1pl #undef log1pl
...@@ -1143,6 +1145,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1143,6 +1145,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using ::lgammaf; using ::lgammaf;
using ::lgammal; using ::lgammal;
#ifndef _GLIBCXX_NO_C99_ROUNDING_FUNCS
using ::llrint; using ::llrint;
using ::llrintf; using ::llrintf;
using ::llrintl; using ::llrintl;
...@@ -1150,6 +1153,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1150,6 +1153,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using ::llround; using ::llround;
using ::llroundf; using ::llroundf;
using ::llroundl; using ::llroundl;
#endif
using ::log1p; using ::log1p;
using ::log1pf; using ::log1pf;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment