Author: Louis Dionne Date: 2025-02-19T06:26:51-08:00 New Revision: 876a5c9e5905a9666748632afba1ff83200ed95b
URL: https://github.com/llvm/llvm-project/commit/876a5c9e5905a9666748632afba1ff83200ed95b DIFF: https://github.com/llvm/llvm-project/commit/876a5c9e5905a9666748632afba1ff83200ed95b.diff LOG: [libc++] Avoid including <features.h> on arbitrary platforms (#125587) This partially reverts commit 5f2389d4. That commit started checking whether <features.h> was a valid include unconditionally, however codebases are free to have such a header on their search path, which breaks compilation. LLVM libc now provides a more standard way of getting configuration macros like __LLVM_LIBC__. After this patch, we only include <features.h> when we're on Linux or when we're compiling for GPUs. (cherry picked from commit cffc1ac3491c891ef4f80bcbfa685710e477eeac) Added: Modified: libcxx/include/__configuration/platform.h Removed: ################################################################################ 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 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits