[libcxx-commits] [libcxx] [libc++] Guard additional headers with _LIBCPP_HAS_LOCALIZATION (PR #131921)
Dominik Wójt via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Mar 27 02:33:51 PDT 2025
domin144 wrote:
Just some more notes:
- `config-ix.cmake` already detects picolibc,
- picolibc does not always define `off_t` to be `long` (`newlib/libc/include/sys/_types.h`):
```
#ifndef __machine_off_t_defined
#if __SIZEOF_SIZE_T__ == 8 && __SIZEOF_LONG__ < 8
typedef __uint64_t _off_t;
#else
typedef long _off_t;
#endif
#endif
```
Possible better check to add to `config-ix.cmake`:
```
set(_LIBCPP_STREAMOFF_TYPE "long long")
check_cxx_source_compiles("
#include <stdio.h>
template<typename T, typename U> struct is_same;
template<typename T> struct is_same<T, T> {
typedef bool type;
};
const is_same<off_t, long>::type x = true;
int main() {return 0;}
" STREAM_OFF_T_IS_LONG)
if(STREAM_OFF_T_IS_LONG)
set(_LIBCPP_STREAMOFF_TYPE "long")
endif()
```
This would change the type only if `off_t` is defined and is `long`.
https://github.com/llvm/llvm-project/pull/131921
More information about the libcxx-commits
mailing list