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 <staffantj@users.noreply.github.com>
This commit is contained in:
staffantj 2022-01-10 10:44:42 -05:00 committed by GitHub
parent 6dfe7afbc3
commit 0e78738a25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;