Repository navigation
libcxx: fixups for __BIONIC__ - #219591
Conversation
|
cc @llvm/android-maintainers |
|
@llvm/pr-subscribers-libcxx Author: Nick Desaulniers (nickdesaulniers) ChangesA few header guards seem to check various libc's, but not Android's libc Bionic supports:
Link: https://android-review.git.corp.google.com/c/platform/bionic/+/41445 3 Files Affected:
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 31c573ba5dca3..2ac003149f2da 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -82,8 +82,8 @@
// Use rand_s(), for use on Windows.
// When this option is used, the token passed to `std::random_device`'s
// constructor *must* be "/dev/urandom" -- anything else is an error.
-# if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
- defined(__DragonFly__)
+# if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
+ defined(__OpenBSD__) || defined(__DragonFly__) || defined(__BIONIC__) \
# define _LIBCPP_USING_ARC4_RANDOM
# elif defined(__wasi__) || defined(__EMSCRIPTEN__)
# define _LIBCPP_USING_GETENTROPY
diff --git a/libcxx/include/__cxx03/__config b/libcxx/include/__cxx03/__config
index 6679494a1f936..76b1cd452b2c0 100644
--- a/libcxx/include/__cxx03/__config
+++ b/libcxx/include/__cxx03/__config
@@ -269,8 +269,8 @@ _LIBCPP_HARDENING_MODE_DEBUG
// Use rand_s(), for use on Windows.
// When this option is used, the token passed to `std::random_device`'s
// constructor *must* be "/dev/urandom" -- anything else is an error.
-# if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
- defined(__DragonFly__)
+# if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
+ defined(__OpenBSD__) || defined(__DragonFly__) || defined(__BIONIC__) \
# define _LIBCPP_USING_ARC4_RANDOM
# elif defined(__wasi__) || defined(__EMSCRIPTEN__)
# define _LIBCPP_USING_GETENTROPY
diff --git a/libcxx/src/filesystem/operations.cpp b/libcxx/src/filesystem/operations.cpp
index 3ff62c102d0ad..af12cbd2e24ea 100644
--- a/libcxx/src/filesystem/operations.cpp
+++ b/libcxx/src/filesystem/operations.cpp
@@ -40,8 +40,9 @@
#include <fcntl.h> /* values for fchmodat */
#include <time.h>
-// since Linux 4.5 and FreeBSD 13, but the Linux libc wrapper is only provided by glibc >= 2.27 and musl
-#if _LIBCPP_GLIBC_PREREQ(2, 27) || _LIBCPP_HAS_MUSL_LIBC || defined(__FreeBSD__)
+// Since Linux 4.5 and FreeBSD 13, but the Linux libc wrapper is only provided
+// by glibc >= 2.27, musl, and Bionic.
+#if _LIBCPP_GLIBC_PREREQ(2, 27) || _LIBCPP_HAS_MUSL_LIBC || defined(__FreeBSD__) || defined(__BIONIC__)
# define _LIBCPP_FILESYSTEM_USE_COPY_FILE_RANGE
#endif
@@ -564,7 +565,7 @@ void __create_symlink(path const& from, path const& to, error_code* ec) {
path __current_path(error_code* ec) {
ErrorHandler<path> err("current_path", ec);
-#if defined(_WIN32) || defined(__GLIBC__) || defined(__APPLE__)
+#if defined(_WIN32) || defined(__GLIBC__) || defined(__APPLE__) || defined(__BIONIC__)
// Common extension outside of POSIX getcwd() spec, without needing to
// preallocate a buffer. Also supported by a number of other POSIX libcs.
int size = 0;
|
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
02b949d to
5053c5e
Compare
5053c5e to
22844ed
Compare
A few header guards seem to check various libc's, but not Android's libc (Bionic). Bionic supports: - arc4random - copy_file_range - getcwd() extension Link: https://android-review.git.corp.google.com/c/platform/bionic/+/41445 Link: https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/SYSCALLS.TXT Link: https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/upstream-openbsd/lib/libc/crypt/arc4random.c
22ed439 to
d2953f3
Compare
enh-google
left a comment
There was a problem hiding this comment.
yes, this version matches bionic's reality :-)
A few header guards seem to check various libc's, but not Android's libc (Bionic). Bionic supports: - arc4random - copy_file_range - getcwd() extension Link: https://android-review.git.corp.google.com/c/platform/bionic/+/41445 Link: https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/SYSCALLS.TXT Link: https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/upstream-openbsd/lib/libc/crypt/arc4random.c
A few header guards seem to check various libc's, but not Android's libc (Bionic). Bionic supports: - arc4random - copy_file_range - getcwd() extension Link: https://android-review.git.corp.google.com/c/platform/bionic/+/41445 Link: https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/SYSCALLS.TXT Link: https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/upstream-openbsd/lib/libc/crypt/arc4random.c
A few header guards seem to check various libc's, but not Android's libc (Bionic). Bionic supports: - arc4random - copy_file_range - getcwd() extension Link: https://android-review.git.corp.google.com/c/platform/bionic/+/41445 Link: https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/SYSCALLS.TXT Link: https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/upstream-openbsd/lib/libc/crypt/arc4random.c
A few header guards seem to check various libc's, but not Android's libc
(Bionic).
Bionic supports:
Link: https://android-review.git.corp.google.com/c/platform/bionic/+/41445
Link: https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/SYSCALLS.TXT
Link: https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/upstream-openbsd/lib/libc/crypt/arc4random.c