[llvm-branch-commits] [libcxx] release/20.x: [libc++] Avoid including <features.h> on arbitrary platforms (#125587) (PR #127310)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Feb 15 02:00:21 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: None (llvmbot)

<details>
<summary>Changes</summary>

Backport cffc1ac3491c891ef4f80bcbfa685710e477eeac

Requested by: @<!-- -->ldionne

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


1 Files Affected:

- (modified) libcxx/include/__configuration/platform.h (+2-5) 


``````````diff
diff --git a/libcxx/include/__configuration/platform.h b/libcxx/include/__configuration/platform.h
index 2a92ce209b91f..cff99376ee24b 100644
--- a/libcxx/include/__configuration/platform.h
+++ b/libcxx/include/__configuration/platform.h
@@ -30,12 +30,9 @@
 // ... add new file formats here ...
 #endif
 
-// To detect which libc we're using
-#if __has_include(<features.h>)
+// Need to detect which libc we're using if we're on Linux.
+#if defined(__linux__) || defined(__AMDGPU__) || defined(__NVPTX__)
 #  include <features.h>
-#endif
-
-#if defined(__linux__)
 #  if defined(__GLIBC_PREREQ)
 #    define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b)
 #  else

``````````

</details>


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


More information about the llvm-branch-commits mailing list