fix(Clang CodeGen): remove warnings

./fmt/fmt/format.h(308,10): warning : unknown pragma ignored [-Wunknown-pragmas]
# pragma intrinsic(_BitScanReverse)
         ^
1 warning generated.
format.cc In file included from fmt\fmt\format.cc:28:
fmt\fmt/format.h(308,10): warning : unknown pragma ignored [-Wunknown-pragmas]
# pragma intrinsic(_BitScanReverse)
         ^
fmt\fmt\format.cc(165,17): warning : 'strerror' is deprecated: This
function or variable may be unsafe. Consider using strerror_s instead.
To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for
details. [-Wdeprecated-declarations]
      buffer_ = strerror(error_code_);
                ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\string.h(178,24) :  note: 'strerror' has been explicitly marked deprecated here
_ACRTIMP char* __cdecl strerror(
                       ^
fmt\fmt\format.cc(78,37): warning : unused function 'strerror_s' [-Wunused-function]
static inline fmt::internal::Null<> strerror_s(char *, std::size_t, ...) {
                                    ^
3 warnings generated.
This commit is contained in:
yumetodo 2017-10-14 13:54:23 +09:00
parent 933a33a794
commit 69c0a24af6
No known key found for this signature in database
GPG Key ID: 894C4304830A7319
2 changed files with 24 additions and 2 deletions

View File

@ -70,6 +70,11 @@
# pragma warning(disable: 4996) # pragma warning(disable: 4996)
#endif #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 // 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 *, ...) { static inline fmt::internal::Null<> strerror_r(int, char *, ...) {
@ -79,6 +84,10 @@ static inline fmt::internal::Null<> strerror_s(char *, std::size_t, ...) {
return fmt::internal::Null<>(); return fmt::internal::Null<>();
} }
#ifdef __c2__
# pragma clang diagnostic pop
#endif
namespace fmt { namespace fmt {
FMT_FUNC internal::RuntimeError::~RuntimeError() FMT_DTOR_NOEXCEPT {} FMT_FUNC internal::RuntimeError::~RuntimeError() FMT_DTOR_NOEXCEPT {}
@ -159,6 +168,11 @@ int safe_strerror(
ERANGE : result; ERANGE : result;
} }
#ifdef __c2__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
// Fallback to strerror if strerror_r and strerror_s are not available. // Fallback to strerror if strerror_r and strerror_s are not available.
int fallback(internal::Null<>) { int fallback(internal::Null<>) {
errno = 0; errno = 0;
@ -166,6 +180,10 @@ int safe_strerror(
return errno; return errno;
} }
#ifdef __c2__
# pragma clang diagnostic pop
#endif
public: public:
StrError(int err_code, char *&buf, std::size_t buf_size) StrError(int err_code, char *&buf, std::size_t buf_size)
: error_code_(err_code), buffer_(buf), buffer_size_(buf_size) {} : error_code_(err_code), buffer_(buf), buffer_size_(buf_size) {}

View File

@ -335,7 +335,10 @@ typedef __int64 intmax_t;
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);
@ -349,7 +352,8 @@ 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 // avoid Clang with Microsoft CodeGen's -Wunknown-pragmas warning
# if defined(_WIN64) && !defined(__clang__)
# pragma intrinsic(_BitScanReverse64) # pragma intrinsic(_BitScanReverse64)
# endif # endif