[libc-commits] [PATCH] D130662: [libc] Read and write errno via special getter and setter functions.

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Jul 27 16:09:50 PDT 2022


lntue added inline comments.


================
Comment at: libc/src/errno/errno.cpp:15
+
+thread_local int __llvmlibc_test_errno = 0;
----------------
mcgrathr wrote:
> IMHO this doesn't really belong in the same directory as the "real" errno, let alone the same file.
> 
> I don't understand why these variables aren't inside `namespace __llvm_libc` like other internal symbols.
> 
I agree, at least based on its name, some test util is a better place for it.  Also, is the test_errno only used for some tests or for all the tests?


================
Comment at: libc/src/errno/llvmlibc_errno.h:13
+#ifdef LLVM_LIBC_PUBLIC_PACKAGING
+#include <errno.h>
+#define ACTIVE_ERRNO errno
----------------
Do we have to worry that under the normal testing environments without `LLVM_LIBC_PUBLIC_PACKAGING`, their behavior might diverge due to the inclusion / missing of `errno.h` header?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130662/new/

https://reviews.llvm.org/D130662



More information about the libc-commits mailing list