Skip to content

Commit d84570d

Browse files
committed
[libcxx] Do not redeclare lgamma_r when targeting the LLVM C library
Summary: We use `lgamma_r` for the random normal distrubtion support. In this code we redeclare it, which caused issues with the LLVM C library as this function has the `noexcept` flag. Also make sure we include `features.h` when using the GPU so it gets this as well.
1 parent 9fea731 commit d84570d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

libcxx/include/__configuration/platform.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
# else
3939
# define _LIBCPP_GLIBC_PREREQ(a, b) 0
4040
# endif // defined(__GLIBC_PREREQ)
41-
#endif // defined(__linux__)
41+
#elif defined(__AMDGPU__) || defined(__NVPTX__)
42+
# include <features.h>
43+
#endif
4244

4345
#ifndef __BYTE_ORDER__
4446
# error \

libcxx/include/__random/binomial_distribution.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ class _LIBCPP_TEMPLATE_VIS binomial_distribution {
9797
}
9898
};
9999

100-
#ifndef _LIBCPP_MSVCRT_LIKE
100+
// The LLVM C library provides this with conflicting `noexcept` attributes.
101+
#if !defined(_LIBCPP_MSVCRT_LIKE) && !defined(__LLVM_LIBC__)
101102
extern "C" double lgamma_r(double, int*);
102103
#endif
103104

0 commit comments

Comments
 (0)