diff --git a/dune/xt/common/fixed_map.hh b/dune/xt/common/fixed_map.hh index b0fe784b27f24d9ecd8dcf67077147ab68ea6e43..ca4b88ab67be4425b6def86309683163ede05b5d 100644 --- a/dune/xt/common/fixed_map.hh +++ b/dune/xt/common/fixed_map.hh @@ -125,7 +125,7 @@ private: typedef FixedMap<key_imp, T, nin> ThisType; - std::string range_error_message(key_imp key) const + std::string range_error_message([[maybe_unused]] key_imp key) const { std::stringstream ss; if constexpr (std::is_convertible<key_imp, std::string>::value) { diff --git a/dune/xt/common/string.hh b/dune/xt/common/string.hh index 5f16a9435e78d76cbd822466588c284f542b106f..11b186f6193336e4abc2e96004bea8a7d95a5f2a 100644 --- a/dune/xt/common/string.hh +++ b/dune/xt/common/string.hh @@ -129,10 +129,8 @@ std::string whitespaceify(const T& t, const char whitespace = ' ') { const std::string s = to_string(t); std::string ret = ""; - for (auto ii : value_range(s.size())) { + for ([[maybe_unused]] auto ii : value_range(s.size())) ret += whitespace; - (void)ii; - } return ret; } // ... whitespaceify(...) diff --git a/dune/xt/functions/interfaces/element-functions.hh b/dune/xt/functions/interfaces/element-functions.hh index f97daea9278723e952be950fc26017afa98a5979..eb708c0d9940210b7ff2ac08480481a5a82d1090 100644 --- a/dune/xt/functions/interfaces/element-functions.hh +++ b/dune/xt/functions/interfaces/element-functions.hh @@ -417,10 +417,11 @@ private: template <class FullType, class SingleType> void single_derivative_helper_call(const std::vector<FullType>& val, const size_t row, - const size_t col, + [[maybe_unused]] const size_t col, std::vector<SingleType>& ret) const { if constexpr (rC == 1) { + assert(col == 0); for (size_t ii = 0; ii < val.size(); ++ii) ret[ii] = val[ii][row]; } else { @@ -705,9 +706,10 @@ public: private: template <class FullType> static SingleDerivativeRangeType - single_derivative_helper_call(const FullType& val, const size_t row, const size_t col) + single_derivative_helper_call(const FullType& val, const size_t row, [[maybe_unused]] const size_t col) { if constexpr (rC == 1) { + assert(col == 0); return val[row]; } else { SingleDerivativeRangeType ret; diff --git a/dune/xt/grid/information.hh b/dune/xt/grid/information.hh index f86fa9c6b3ad0d9aaf8dbc5b1c324ba8089bb06f..353474baddbf28051af63a0726cb84bc6b6335e9 100644 --- a/dune/xt/grid/information.hh +++ b/dune/xt/grid/information.hh @@ -83,10 +83,8 @@ size_t max_number_of_neighbors(const GridLayerType& grid_layer) size_t maxNeighbours = 0; for (auto&& entity : elements(grid_layer)) { size_t neighbours = 0; - for (auto&& intersection : intersections(grid_layer, entity)) { - (void)intersection; // silence unused variable warning + for ([[maybe_unused]] auto&& intersection : intersections(grid_layer, entity)) ++neighbours; - } maxNeighbours = std::max(maxNeighbours, neighbours); } return maxNeighbours; diff --git a/dune/xt/test/common/timings.cc b/dune/xt/test/common/timings.cc index 0bc761ac7e160fa5f4b29e0a9278fe16fd39412d..9ecd09941a99c5602879d55a12f0247bca6dc0a0 100644 --- a/dune/xt/test/common/timings.cc +++ b/dune/xt/test/common/timings.cc @@ -45,9 +45,8 @@ GTEST_TEST(ProfilerTest, Timing) GTEST_TEST(ProfilerTest, ScopedTiming) { const auto dvalue_range = value_range(1, 4); - for ([[maybe_unused] auto i : dvalue_range) { + for ([[maybe_unused]] auto i : dvalue_range) scoped_busywait("ProfilerTest.ScopedTiming", wait_ms); - } EXPECT_GE(DXTC_TIMINGS.walltime("ProfilerTest.ScopedTiming"), long(dvalue_range.size() * wait_ms)); } diff --git a/dune/xt/test/grid/periodic_gridview.cc b/dune/xt/test/grid/periodic_gridview.cc index 50394ea526f2c7e7685e64b127ff1ea6aabc4ff9..8ec0502efc80d6fe53cdc2c2ebb2aa4ab2e0b302 100644 --- a/dune/xt/test/grid/periodic_gridview.cc +++ b/dune/xt/test/grid/periodic_gridview.cc @@ -80,8 +80,7 @@ struct PeriodicViewTest : public testing::Test const PeriodicGridViewType periodic_grid_view(grid_view, periodic_directions); // check interface - const GridType& test_grid = periodic_grid_view.grid(); - (void)test_grid; + [[maybe_unused]] const GridType& test_grid = periodic_grid_view.grid(); const IndexSet& index_set = periodic_grid_view.indexSet(); const int codim0_size = periodic_grid_view.size(0); EXPECT_EQ(grid_view.size(0), codim0_size); @@ -95,8 +94,7 @@ struct PeriodicViewTest : public testing::Test EXPECT_EQ(grid_view.overlapSize(1), periodic_grid_view.overlapSize(1)); EXPECT_EQ(grid_view.ghostSize(0), periodic_grid_view.ghostSize(0)); EXPECT_EQ(grid_view.ghostSize(1), periodic_grid_view.ghostSize(1)); - const CollectiveCommunication& test_comm = periodic_grid_view.comm(); - (void)test_comm; + [[maybe_unused]] const CollectiveCommunication& test_comm = periodic_grid_view.comm(); size_t neighbor_count = 0; @@ -106,8 +104,7 @@ struct PeriodicViewTest : public testing::Test for (auto&& element : elements(periodic_grid_view)) { EXPECT_TRUE(periodic_grid_view.contains(element)); EXPECT_TRUE(index_set.contains(element)); - const auto sub_index = index_set.subIndex(element, 0, 1); - (void)sub_index; + [[maybe_unused]] const auto sub_index = index_set.subIndex(element, 0, 1); // iterate over all intersections on current element for (auto&& intersection : intersections(periodic_grid_view, element)) { if (intersection.neighbor()) {