From 0ea3080fd479f0cff6888861c1f7f9573cb4204e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 6 May 2021 12:14:18 +0100 Subject: [PATCH] Avoid harmless warning about unreachable statement in MSVS build Don't compile "return 0" after throw_spdlog_ex() when using MSVS as this compiler (at least its 2019 edition) is smart enough to warn about this statement being unreachable after throw inside this inline function. --- include/spdlog/details/os-inl.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/spdlog/details/os-inl.h b/include/spdlog/details/os-inl.h index a701e13f..4a977c55 100644 --- a/include/spdlog/details/os-inl.h +++ b/include/spdlog/details/os-inl.h @@ -246,7 +246,11 @@ SPDLOG_INLINE size_t filesize(FILE *f) #endif #endif throw_spdlog_ex("Failed getting file size from fd", errno); + + // avoid C4702 warning about unreachable statement. +#ifndef _MSC_VER return 0; // will not be reached. +#endif } // Return utc offset in minutes or throw spdlog_ex on failure