[libc-commits] [PATCH] D71094: [libc] Add implementation of errno and define the other macros of errno.h.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Dec 6 00:36:12 PST 2019


sivachandra marked an inline comment as done.
sivachandra added inline comments.


================
Comment at: libc/src/errno/llvmlibc_errno.h:14
+// public header.
+extern int &llvmlibc_errno;
+
----------------
abrachet wrote:
> MaskRay wrote:
> > I don't think this will work. In the test translation unit, the compiler does not know that `llvmlibc_errno` is bound to a thread-local variable.
> > 
> > Even in the definition site, it's not clear to me that a reference to a thread-local variable will guarantee to work.
> Right, it must be `thread_local int &`. I've tested it only briefly, if the reference isn't `thread_local` it doesn't work. As far as I can tell `thread_local int &` works.
> 
> 
Sigh yes. This declaration has to include `thread_local` for everything to work correctly. Will update in the next round.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71094





More information about the libc-commits mailing list