EricWF added a comment. In http://reviews.llvm.org/D20903#446922, @mclow.lists wrote:
> In general, I'm OK with this - but I'm concerned about that there's not > really any provision for the case where `strerror_r` does not exist. > > Also, there's no reason to have a thread local static array here, if you're > going to immediately copy it into a `std::string`. Ack. I changed the arrays to be neither static nor thread_local. In http://reviews.llvm.org/D20903#447650, @erik65536 wrote: > The C++ spec states that `error_category::message()` shall not change the > value of `errno` (See section 19.5). So `errno` will have to be saved and > restored if `strerror_r()` fails. Good catch. I only have to do this for the POSIX version. I'll make the change. > The POSIX version of `strerror_r()` returns 0 on success, and any other value > indicates an error (Reference > <http://pubs.opengroup.org/onlinepubs/9699919799/functions/strerror.html>). > > The function may return uninitialized memory if `std::snprintf()` fails. I don't see how snprintf could possible fail. > You may want to a version for Windows that calls `strerror_s()`. Libc++ provides no windows support. http://reviews.llvm.org/D20903 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits