Fix warnings

This commit is contained in:
Victor Zverovich 2018-02-10 06:28:33 -08:00
parent 0b635c9dc5
commit 6cb68f9496
2 changed files with 7 additions and 6 deletions

View File

@ -59,10 +59,10 @@
// Dummy implementations of strerror_r and strerror_s called if corresponding // Dummy implementations of strerror_r and strerror_s called if corresponding
// system functions are not available. // system functions are not available.
static inline fmt::internal::null<> strerror_r(int, char *, ...) { inline fmt::internal::null<> strerror_r(int, char *, ...) {
return fmt::internal::null<>(); return fmt::internal::null<>();
} }
static inline fmt::internal::null<> strerror_s(char *, std::size_t, ...) { inline fmt::internal::null<> strerror_s(char *, std::size_t, ...) {
return fmt::internal::null<>(); return fmt::internal::null<>();
} }
@ -157,8 +157,6 @@ int safe_strerror(
: error_code_(err_code), buffer_(buf), buffer_size_(buf_size) {} : error_code_(err_code), buffer_(buf), buffer_size_(buf_size) {}
int run() { int run() {
// Suppress a warning about unused strerror_r.
strerror_r(0, FMT_NULL, "");
return handle(strerror_r(error_code_, buffer_, buffer_size_)); return handle(strerror_r(error_code_, buffer_, buffer_size_));
} }
}; };

View File

@ -160,7 +160,10 @@
namespace fmt { namespace fmt {
namespace internal { namespace internal {
# pragma intrinsic(_BitScanReverse) // Avoid Clang with Microsoft CodeGen's -Wunknown-pragmas warning.
# ifndef __clang__
# pragma intrinsic(_BitScanReverse)
# endif
inline uint32_t clz(uint32_t x) { inline uint32_t clz(uint32_t x) {
unsigned long r = 0; unsigned long r = 0;
_BitScanReverse(&r, x); _BitScanReverse(&r, x);
@ -174,7 +177,7 @@ inline uint32_t clz(uint32_t x) {
} }
# define FMT_BUILTIN_CLZ(n) fmt::internal::clz(n) # define FMT_BUILTIN_CLZ(n) fmt::internal::clz(n)
# ifdef _WIN64 # if defined(_WIN64) && !defined(__clang__)
# pragma intrinsic(_BitScanReverse64) # pragma intrinsic(_BitScanReverse64)
# endif # endif