Skip to content

Commit

Permalink
Workaround to error: variable 'n' set but not used [-Werror,-Wunused-…
Browse files Browse the repository at this point in the history
…but-set-variable]

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
  • Loading branch information
phprus committed May 3, 2023
1 parent d8973bf commit 262493a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/gtest-extra-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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, ""), "");
Expand All @@ -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, ""), "");
Expand Down

0 comments on commit 262493a

Please sign in to comment.