[llvm-commits] Adding a portable strerror*() wrapper, llvm::sys::StrError()

Jeffrey Yasskin jyasskin at google.com
Mon Jun 29 10:52:33 PDT 2009


My oprofile patch calls some functions that report errors through
errno, and since strerror_r changes its behavior depending on
GNU_SOURCE and other #defines, I figured it would be nice to have a
portable wrapper in llvm/System/Errno.h. I included the windows
version, strerror_s, even though I can't test it.

This won't do quite the right thing on cmake builds--although it will
run successfully--since cmake doesn't define HAVE_STRERROR*.

I wasn't sure quite what to do with MakeErrStr. I'd be perfectly happy
with that as the interface in Errno.h, but it does different things on
Windows and Unix, and I didn't want a public function to be ambiguous
like that.

Tested with `make check` on Ubuntu and OS X.

Jeffrey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: errno.patch
Type: text/x-patch
Size: 11946 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090629/72c27ce7/attachment.bin>


More information about the llvm-commits mailing list