From 0e78738a2541f81fa4103ead4c4bacfc19bd39bf Mon Sep 17 00:00:00 2001 From: staffantj <8728287+staffantj@users.noreply.github.com> Date: Mon, 10 Jan 2022 10:44:42 -0500 Subject: [PATCH] Destructor not returning is expected in some cases (#1316) * Address MSVC C4722 warning in tests Some test paths deliberately exit, and it appears that the appropriate declspec does not stop the compiler generating the C4722 warning as one might expect. Per https://github.com/google/benchmark/issues/826#issuecomment-851995549 this commit ignores the warning for the affected call site. * Fix up Formatting * Fix up formatting issue on pragmas * Fix up formatting issue on pragmas take 2 Co-authored-by: Staffan Tjernstrom --- src/check.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/check.h b/src/check.h index 0efd13ff..90c7bbfa 100644 --- a/src/check.h +++ b/src/check.h @@ -36,10 +36,17 @@ class CheckHandler { LogType& GetLog() { return log_; } +#if defined(COMPILER_MSVC) +#pragma warning(push) +#pragma warning(disable : 4722) +#endif BENCHMARK_NORETURN ~CheckHandler() BENCHMARK_NOEXCEPT_OP(false) { log_ << std::endl; CallAbortHandler(); } +#if defined(COMPILER_MSVC) +#pragma warning(pop) +#endif CheckHandler& operator=(const CheckHandler&) = delete; CheckHandler(const CheckHandler&) = delete;