Skip to content

Conversation

llvmbot
Copy link
Member

@llvmbot llvmbot commented Feb 19, 2025

Backport 2c8b124

Requested by: @ldionne

@llvmbot llvmbot requested a review from a team as a code owner February 19, 2025 18:23
@llvmbot llvmbot added this to the LLVM 20.X Release milestone Feb 19, 2025
@llvmbot
Copy link
Member Author

llvmbot commented Feb 19, 2025

@jhuber6 What do you think about merging this PR to the release branch?

@llvmbot llvmbot requested a review from jhuber6 February 19, 2025 18:24
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Feb 19, 2025
@llvmbot
Copy link
Member Author

llvmbot commented Feb 19, 2025

@llvm/pr-subscribers-libcxx

Author: None (llvmbot)

Changes

Backport 2c8b124

Requested by: @ldionne


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

1 Files Affected:

  • (modified) libcxx/include/__configuration/platform.h (+8-6)
diff --git a/libcxx/include/__configuration/platform.h b/libcxx/include/__configuration/platform.h
index cff99376ee24b..8d0f8f63f5213 100644
--- a/libcxx/include/__configuration/platform.h
+++ b/libcxx/include/__configuration/platform.h
@@ -32,12 +32,14 @@
 
 // Need to detect which libc we're using if we're on Linux.
 #if defined(__linux__) || defined(__AMDGPU__) || defined(__NVPTX__)
-#  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)
+#  if __has_include(<features.h>)
+#    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
 
 #ifndef __BYTE_ORDER__

Some configurations define __AMDGPU__ or __NVPTX__ on platforms that
don't provide <features.h>, such as CUDA on Mac.

(cherry picked from commit 2c8b124)
@tstellar tstellar merged commit d420bf8 into llvm:release/20.x Feb 20, 2025
11 of 15 checks passed
Copy link

@ldionne (or anyone else). If you would like to add a note about this fix in the release notes (completely optional). Please reply to this comment with a one or two sentence description of the fix. When you are done, please add the release:note label to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
Development

Successfully merging this pull request may close these issues.

4 participants