[libcxx-commits] [libcxx] Remove incorrect forward-declaration of lgamma_r header (PR #80979)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Feb 7 03:55:22 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Yuriy Chernyshov (georgthegreat)
<details>
<summary>Changes</summary>
libc++ declares `lgamma_r` as:
```
extern "C" double lgamma_r(double, int *);
```
while modern glibc uses the following:
```
__MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp));
```
This causes (I did not digged to the very bottom of it) the following compilation error when compiling with nvcc:
```
libcxx/include/__random/binomial_distribution.h(117): error: linkage specification is incompatible with previous "lgamma_r"
/usr/include/x86_64-linux-gnu/bits/mathcalls.h(271): here
```
---
Full diff: https://github.com/llvm/llvm-project/pull/80979.diff
1 Files Affected:
- (modified) libcxx/include/__random/binomial_distribution.h (-4)
``````````diff
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);
``````````
</details>
https://github.com/llvm/llvm-project/pull/80979
More information about the libcxx-commits
mailing list