refactor: use dummy function call instead of using #pragma

This commit is contained in:
yumetodo 2017-10-15 00:51:09 +09:00
parent 69c0a24af6
commit 05272b8e8e
No known key found for this signature in database
GPG Key ID: 894C4304830A7319

View File

@ -70,11 +70,6 @@
# pragma warning(disable: 4996)
#endif
#ifdef __c2__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wunused-function"
#endif
// Dummy implementations of strerror_r and strerror_s called if corresponding
// system functions are not available.
static inline fmt::internal::Null<> strerror_r(int, char *, ...) {
@ -84,10 +79,6 @@ static inline fmt::internal::Null<> strerror_s(char *, std::size_t, ...) {
return fmt::internal::Null<>();
}
#ifdef __c2__
# pragma clang diagnostic pop
#endif
namespace fmt {
FMT_FUNC internal::RuntimeError::~RuntimeError() FMT_DTOR_NOEXCEPT {}
@ -189,8 +180,9 @@ int safe_strerror(
: error_code_(err_code), buffer_(buf), buffer_size_(buf_size) {}
int run() {
// Suppress a warning about unused strerror_r.
// Suppress a warning about unused strerror_r and strerror_s.
strerror_r(0, FMT_NULL, "");
strerror_s(FMT_NULL, 0, "");
return handle(strerror_r(error_code_, buffer_, buffer_size_));
}
};