[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 15:39:25 PST 2019


sivachandra marked 2 inline comments as done.
sivachandra added inline comments.


================
Comment at: libc/spec/posix.td:1
+def POSIX : StandardSpec<"POSIX"> {
+  HeaderSpec Errno = HeaderSpec<
----------------
stanshebs wrote:
> Is this expected to be definitive for what POSIX specifies?  EHWPOISON is Linux-only I think.
> 
I do not know if https://pubs.opengroup.org/onlinepubs/9699919799/ is a definitive guide, but I have now split this list up into POSIX and Linux based on that link.


================
Comment at: libc/src/errno/errno_location.cpp:15
+
+static thread_local int __errno = 0;
+
----------------
stanshebs wrote:
> One bit of handiness that glibc does is to alias it its version of __errno with plain "errno", so you see it as "errno" in a debugger, object file dumps, etc.  (In theory, getting errno through macro expansion and function call should be possible in debugger, but is much less straightforward and more likely to fail, as with core dumps.)
> 
Aliases in C++ code will require mangled names. One can use the same section trick, but prefer to do it in a later pass iff required.


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