[libcxx-commits] [libcxx] [libc++] Revert "Do not redeclare lgamma_r when targeting the LLVM C library (#102036) (PR #125587)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Feb 3 13:27:02 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

<details>
<summary>Changes</summary>

This reverts commit 5f2389d4. That commit started checking whether <features.h> was a valid include, however codebases are free to have such a header on their search path, which breaks compilation. LLVM libc should instead provide a more standard way of getting configuration macros like __LLVM_LIBC__.

---
Full diff: https://github.com/llvm/llvm-project/pull/125587.diff


2 Files Affected:

- (modified) libcxx/include/__configuration/platform.h (+3-6) 
- (modified) libcxx/include/__random/binomial_distribution.h (+1-2) 


``````````diff
diff --git a/libcxx/include/__configuration/platform.h b/libcxx/include/__configuration/platform.h
index 2a92ce209b91f8b..27f68d04e8a8d9c 100644
--- a/libcxx/include/__configuration/platform.h
+++ b/libcxx/include/__configuration/platform.h
@@ -30,18 +30,15 @@
 // ... add new file formats here ...
 #endif
 
-// To detect which libc we're using
-#if __has_include(<features.h>)
-#  include <features.h>
-#endif
-
+// Need to detect which libc we're using if we're on Linux.
 #if defined(__linux__)
+#  include <features.h>
 #  if defined(__GLIBC_PREREQ)
 #    define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b)
 #  else
 #    define _LIBCPP_GLIBC_PREREQ(a, b) 0
 #  endif // defined(__GLIBC_PREREQ)
-#endif
+#endif   // defined(__linux__)
 
 #ifndef __BYTE_ORDER__
 #  error                                                                                                               \
diff --git a/libcxx/include/__random/binomial_distribution.h b/libcxx/include/__random/binomial_distribution.h
index 9538c15e2dc97b5..47790b674db5882 100644
--- a/libcxx/include/__random/binomial_distribution.h
+++ b/libcxx/include/__random/binomial_distribution.h
@@ -97,8 +97,7 @@ class _LIBCPP_TEMPLATE_VIS binomial_distribution {
   }
 };
 
-// The LLVM C library provides this with conflicting `noexcept` attributes.
-#if !defined(_LIBCPP_MSVCRT_LIKE) && !defined(__LLVM_LIBC__)
+#ifndef _LIBCPP_MSVCRT_LIKE
 extern "C" double lgamma_r(double, int*);
 #endif
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/125587


More information about the libcxx-commits mailing list