mirror of
https://github.com/ToruNiina/toml11.git
synced 2024-11-09 14:20:06 +00:00
fix: let __DARWIN_C as an exception
This commit is contained in:
parent
ed577df40a
commit
0db935b602
@ -37,7 +37,13 @@ inline std::string str_error(int errnum)
|
||||
{
|
||||
return std::string(buf.data());
|
||||
}
|
||||
#elif (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600) || ( defined(__DARWIN_C_LEVEL) && __DARWIN_C_LEVEL >= 200112L ) // macos or POSIX
|
||||
#elif defined(_GNU_SOURCE) && !(defined(__DARWIN_C_LEVEL) && __DARWIN_C_LEVEL >= 200112L )
|
||||
constexpr std::size_t bufsize = 256;
|
||||
std::array<char, bufsize> buf;
|
||||
buf.fill('\0');
|
||||
const char* result = strerror_r(errnum, buf.data(), bufsize);
|
||||
return std::string(result);
|
||||
#elif (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600) || ( defined(__DARWIN_C_LEVEL) && __DARWIN_C_LEVEL >= 200112L ) // macOS
|
||||
constexpr std::size_t bufsize = 256;
|
||||
std::array<char, bufsize> buf;
|
||||
buf.fill('\0');
|
||||
@ -50,12 +56,6 @@ inline std::string str_error(int errnum)
|
||||
{
|
||||
return std::string(buf.data());
|
||||
}
|
||||
#elif defined(_GNU_SOURCE)
|
||||
constexpr std::size_t bufsize = 256;
|
||||
std::array<char, bufsize> buf;
|
||||
buf.fill('\0');
|
||||
const char* result = strerror_r(errnum, buf.data(), bufsize);
|
||||
return std::string(result);
|
||||
#else // fallback
|
||||
return std::strerror(errnum);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user