Skip to content

Commit

Permalink
Fix or suppress last cppcheck issues (Exawind#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrood-nrel authored Dec 17, 2020
1 parent 40df4c7 commit 29a7089
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions amr-wind/core/vs/tensorI.H
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ operator&&(const TensorT<T>& t1, const TensorT<T>& t2)
template <typename T>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T mag_sqr(const TensorT<T>& t)
{
// cppcheck-suppress duplicateExpression
return (t && t);
}

Expand Down
3 changes: 3 additions & 0 deletions unit_tests/core/test_simtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ TEST_F(SimTimeTest, init)
// Check that the timestep growth is not greater than 10% of the last
// timestep
time.set_current_cfl(cur_cfl * 0.5, 0.0, 0.0);
// cppcheck-suppress unreadVariable
EXPECT_NEAR(time.deltaT(), 1.1 * first_dt, tol);
}

Expand Down Expand Up @@ -84,6 +85,7 @@ TEST_F(SimTimeTest, time_loop)
EXPECT_EQ(regrid_counter, 1);

EXPECT_TRUE(time.write_last_checkpoint());
// cppcheck-suppress unreadVariable
EXPECT_FALSE(time.write_last_plot_file());
}

Expand Down Expand Up @@ -115,6 +117,7 @@ TEST_F(SimTimeTest, fixed_dt_loop)
EXPECT_EQ(regrid_counter, 3);

EXPECT_FALSE(time.write_last_checkpoint());
// cppcheck-suppress unreadVariable
EXPECT_FALSE(time.write_last_plot_file());
}

Expand Down
3 changes: 2 additions & 1 deletion unit_tests/core/vs/test_vspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ TEST(VectorSpace, vector_create)

EXPECT_NEAR(v1.x(), v6.x(), tol);
EXPECT_NEAR(v1.y(), v6.y(), tol);
// cppcheck-suppress unreadVariable
EXPECT_NEAR(v1.z(), v6.z(), tol);

test_vector_create_impl();
Expand All @@ -178,7 +179,7 @@ TEST(VectorSpace, vector_ops)

EXPECT_NEAR((v1 & v2), 50.0 * v21, tol);
EXPECT_NEAR((v1 & vs::Vector::khat()), 0.0, tol);

// cppcheck-suppress unreadVariable
EXPECT_NEAR(vs::mag_sqr((v1 + v2) - vs::Vector{11.0, 22.0, 0.0}), 0.0, tol);
}

Expand Down

0 comments on commit 29a7089

Please sign in to comment.