From e84b00e014db287800800806dcb2ba0be74f2d17 Mon Sep 17 00:00:00 2001 From: Vladislav Shchapov Date: Tue, 2 May 2023 21:21:16 +0500 Subject: [PATCH] Workaround to error: variable 'n' set but not used [-Werror,-Wunused-but-set-variable] Signed-off-by: Vladislav Shchapov --- test/gtest-extra-test.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/gtest-extra-test.cc b/test/gtest-extra-test.cc index 69e42bc6..42340a2d 100644 --- a/test/gtest-extra-test.cc +++ b/test/gtest-extra-test.cc @@ -201,6 +201,7 @@ TEST(gtest_extra_test, expect_write_streaming) { // EXPECT_THROW_MSG macro. TEST(gtest_extra_test, expect_throw_no_unreachable_code_warning) { int n = 0; + (void)n; using std::runtime_error; EXPECT_THROW_MSG(throw runtime_error(""), runtime_error, ""); EXPECT_NONFATAL_FAILURE(EXPECT_THROW_MSG(n++, runtime_error, ""), ""); @@ -213,6 +214,7 @@ TEST(gtest_extra_test, expect_throw_no_unreachable_code_warning) { // EXPECT_SYSTEM_ERROR macro. TEST(gtest_extra_test, expect_system_error_no_unreachable_code_warning) { int n = 0; + (void)n; EXPECT_SYSTEM_ERROR(throw fmt::system_error(EDOM, "test"), EDOM, "test"); EXPECT_NONFATAL_FAILURE(EXPECT_SYSTEM_ERROR(n++, EDOM, ""), ""); EXPECT_NONFATAL_FAILURE(EXPECT_SYSTEM_ERROR(throw 1, EDOM, ""), "");