diff --git a/libcxx/include/__random/binomial_distribution.h b/libcxx/include/__random/binomial_distribution.h index e8774bb8d67ee..54f321af63d50 100644 --- a/libcxx/include/__random/binomial_distribution.h +++ b/libcxx/include/__random/binomial_distribution.h @@ -97,10 +97,6 @@ class _LIBCPP_TEMPLATE_VIS binomial_distribution { } }; -#ifndef _LIBCPP_MSVCRT_LIKE -extern "C" double lgamma_r(double, int*); -#endif - inline _LIBCPP_HIDE_FROM_ABI double __libcpp_lgamma(double __d) { #if defined(_LIBCPP_MSVCRT_LIKE) return lgamma(__d); diff --git a/libcxx/include/math.h b/libcxx/include/math.h index 05989734c26c6..0e8bf8f1f65a2 100644 --- a/libcxx/include/math.h +++ b/libcxx/include/math.h @@ -297,6 +297,13 @@ long double truncl(long double x); # pragma GCC system_header # endif +// This is required to define functions like lgamma_r on Apple platforms. +// These functions are not required by the Standard but our implementation +// uses them. +# if defined(__APPLE__) && !defined(_REENTRANT) +# define _REENTRANT +# endif + # if __has_include_next() # include_next # endif