mirror of
https://github.com/ToruNiina/toml11.git
synced 2024-11-24 21:30:13 +00:00
fix: avoid evaluating undefined macro as zero
to suppress a warning
This commit is contained in:
parent
22d22198ec
commit
9b7b8908e8
@ -33,7 +33,12 @@ inline std::string str_error(int errnum)
|
||||
{
|
||||
return std::string(buf.data());
|
||||
}
|
||||
#elif (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE // XSI
|
||||
#elif defined(_GNU_SOURCE)
|
||||
constexpr std::size_t bufsize = 256;
|
||||
std::array<char, bufsize> buf;
|
||||
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)
|
||||
constexpr std::size_t bufsize = 256;
|
||||
std::array<char, bufsize> buf;
|
||||
const int result = strerror_r(errnum, buf.data(), bufsize);
|
||||
@ -45,11 +50,6 @@ inline std::string str_error(int errnum)
|
||||
{
|
||||
return std::string(buf.data());
|
||||
}
|
||||
#elif defined(_GNU_SOURCE) // GNU extension
|
||||
constexpr std::size_t bufsize = 256;
|
||||
std::array<char, bufsize> buf;
|
||||
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