[libcxx-commits] [libcxx] [libc++] Provide flag for RUNTIMES_USE_LIBC=llvm-libc (PR #174967)

Volodymyr Turanskyy via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 8 08:53:35 PST 2026


================
@@ -32,7 +32,7 @@
 #  include <sys/time.h> // for gettimeofday and timeval
 #endif
 
-#if defined(__LLVM_LIBC__)
+#if _LIBCPP_LIBC_LLVM_LIBC
 #  define _LIBCPP_HAS_TIMESPEC_GET
 #endif
----------------
voltur01 wrote:

Thank you for the review and suggestion!

Just to confirm, `_LIBCPP_LIBC_LLVM_LIBC` will be always defined and set to either 0 or 1 depending on the C library in use. So current logic will define the other flag `_LIBCPP_HAS_TIMESPEC_GET` only if `_LIBCPP_LIBC_LLVM_LIBC == 1`.

However, in the suggested simplified definition of `_LIBCPP_HAS_TIMESPEC_GET` it will be always defined even if `_LIBCPP_LIBC_LLVM_LIBC == 0` - taking into account that below in the file https://github.com/llvm/llvm-project/blob/3ae71d30be22711edf278156b67167385a0f9ce0/libcxx/src/filesystem/filesystem_clock.cpp#L59 the check is only whether `_LIBCPP_HAS_TIMESPEC_GET` is defined or not (regardless of its value) setting it to 0 when `_LIBCPP_LIBC_LLVM_LIBC == 0` will change the behavior of the code. So the simplified definition is not equivalent to the current behavior, which, I believe, is undesired.

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


More information about the libcxx-commits mailing list