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

Jeffrey Yasskin jyasskin at google.com
Wed Jul 1 10:38:44 PDT 2009


On Tue, Jun 30, 2009 at 9:30 PM, Chris Lattner<clattner at apple.com> wrote:
>
> On Jun 29, 2009, at 10:52 AM, Jeffrey Yasskin wrote:
>
>> 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.
>
> Seems pretty reasonable for me.  If you think it's ok, please commit.
> Please commit any autoconf regenerations as a separate (second) patch
> though.

Will do, thanks!

I found cmake/config-ix.cmake, which appears to be the right place to
add lines like
  check_symbol_exists(strerror_r string.h HAVE_STRERROR_R)
so cmake now handles this correctly too.




More information about the llvm-commits mailing list