1
0
mirror of https://github.com/gabime/spdlog.git synced 2025-01-15 17:27:57 +00:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Gabi Melman
0a92d1d684
Merge pull request #1931 from vadz/msvc-undef-warning-fix
Fix warning about testing _WIN64 which might be undefined
2021-05-07 01:05:41 +03:00
Vadim Zeitlin
ff5221b693 Fix warning about testing _WIN64 which might be undefined
This warning is disabled by default, but is pretty useful and worth
enabling for MSVC, just as -Wundef for gcc, so fix it in Win32 build.
2021-05-06 22:33:41 +01:00
Gabi Melman
db484cc4b8
Merge pull request #1930 from vadz/msvc-unreachable-warning-fix-alt
Avoid harmless warning about unreachable statement in MSVS build
2021-05-07 00:27:45 +03:00
Vadim Zeitlin
6442963f49 Avoid harmless warning about unreachable statement in MSVS build
All MSVS versions >= 2015 warn about "return 0" after throw_spdlog_ex()
being unreachable in filesize(), so disable this warning in this
function (note that it can't be disabled inside it).
2021-05-06 22:02:25 +01:00

View File

@ -199,6 +199,12 @@ SPDLOG_INLINE bool path_exists(const filename_t &filename) SPDLOG_NOEXCEPT
#endif
}
#ifdef _MSC_VER
// avoid warning about unreachable statement at the end of filesize()
#pragma warning(push)
#pragma warning(disable: 4702)
#endif
// Return file size according to open FILE* object
SPDLOG_INLINE size_t filesize(FILE *f)
{
@ -208,7 +214,7 @@ SPDLOG_INLINE size_t filesize(FILE *f)
}
#if defined(_WIN32) && !defined(__CYGWIN__)
int fd = ::_fileno(f);
#if _WIN64 // 64 bits
#if defined(_WIN64) // 64 bits
__int64 ret = ::_filelengthi64(fd);
if (ret >= 0)
{
@ -249,6 +255,10 @@ SPDLOG_INLINE size_t filesize(FILE *f)
return 0; // will not be reached.
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
// Return utc offset in minutes or throw spdlog_ex on failure
SPDLOG_INLINE int utc_minutes_offset(const std::tm &tm)
{