Refactor warning suppression

This commit is contained in:
Victor Zverovich 2020-11-11 16:16:33 -08:00
parent 60dc273513
commit 9534b9fe69
2 changed files with 10 additions and 10 deletions

View File

@ -49,10 +49,10 @@
#ifdef _MSC_VER
# define FMT_MSC_VER _MSC_VER
# define FMT_SUPPRESS_MSC_WARNING(n) __pragma(warning(suppress : n))
# define FMT_MSC_WARNING(...) __pragma(warning(__VA_ARGS__))
#else
# define FMT_MSC_VER 0
# define FMT_SUPPRESS_MSC_WARNING(n)
# define FMT_MSC_WARNING(...)
#endif
#ifdef __has_feature
@ -203,7 +203,7 @@
#endif
#if !defined(FMT_HEADER_ONLY) && defined(_WIN32)
# define FMT_CLASS_API FMT_SUPPRESS_MSC_WARNING(4275)
# define FMT_CLASS_API FMT_MSC_WARNING(suppress : 4275)
# ifdef FMT_EXPORT
# define FMT_API __declspec(dllexport)
# define FMT_EXTERN_TEMPLATE_API FMT_API
@ -328,7 +328,7 @@ FMT_CONSTEXPR typename std::make_unsigned<Int>::type to_unsigned(Int value) {
return static_cast<typename std::make_unsigned<Int>::type>(value);
}
FMT_SUPPRESS_MSC_WARNING(4566) constexpr unsigned char micro[] = "\u00B5";
FMT_MSC_WARNING(suppress : 4566) constexpr unsigned char micro[] = "\u00B5";
template <typename Char> constexpr bool is_unicode() {
return FMT_UNICODE || sizeof(Char) != 1 ||
@ -671,7 +671,7 @@ template <typename T> class buffer {
protected:
// Don't initialize ptr_ since it is not accessed to save a few cycles.
FMT_SUPPRESS_MSC_WARNING(26495)
FMT_MSC_WARNING(suppress : 26495)
buffer(size_t sz) FMT_NOEXCEPT : size_(sz), capacity_(sz) {}
buffer(T* p = nullptr, size_t sz = 0, size_t cap = 0) FMT_NOEXCEPT

View File

@ -37,9 +37,9 @@
#include <cmath>
#include <cstdint>
#include <limits>
#include <memory>
#include <stdexcept>
#include <utility> // std::swap
#include <memory>
#include "core.h"
@ -223,7 +223,7 @@ inline int clz(uint32_t x) {
// Static analysis complains about using uninitialized data
// "r", but the only way that can happen is if "x" is 0,
// which the callers guarantee to not happen.
FMT_SUPPRESS_MSC_WARNING(6102)
FMT_MSC_WARNING(suppress : 6102)
return 31 ^ static_cast<int>(r);
}
# define FMT_BUILTIN_CLZ(n) detail::clz(n)
@ -239,7 +239,7 @@ inline int clzll(uint64_t x) {
_BitScanReverse(&r, static_cast<uint32_t>(x));
# endif
FMT_ASSERT(x != 0, "");
FMT_SUPPRESS_MSC_WARNING(6102) // Suppress a bogus static analysis warning.
FMT_MSC_WARNING(suppress : 6102) // Suppress a bogus static analysis warning.
return 63 ^ static_cast<int>(r);
}
# define FMT_BUILTIN_CLZLL(n) detail::clzll(n)
@ -248,7 +248,7 @@ inline int ctz(uint32_t x) {
unsigned long r = 0;
_BitScanForward(&r, x);
FMT_ASSERT(x != 0, "");
FMT_SUPPRESS_MSC_WARNING(6102) // Suppress a bogus static analysis warning.
FMT_MSC_WARNING(suppress : 6102) // Suppress a bogus static analysis warning.
return static_cast<int>(r);
}
# define FMT_BUILTIN_CTZ(n) detail::ctz(n)
@ -256,7 +256,7 @@ inline int ctz(uint32_t x) {
inline int ctzll(uint64_t x) {
unsigned long r = 0;
FMT_ASSERT(x != 0, "");
FMT_SUPPRESS_MSC_WARNING(6102) // Suppress a bogus static analysis warning.
FMT_MSC_WARNING(suppress : 6102) // Suppress a bogus static analysis warning.
# ifdef _WIN64
_BitScanForward64(&r, x);
# else