Skip to content

Commit

Permalink
cppcheck: Suppress a few false positives from cppcheck 2.14
Browse files Browse the repository at this point in the history
  • Loading branch information
krivenko committed Jul 16, 2024
1 parent 9b829c0 commit 1689c86
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions include/libcommute/expression/dyn_indices.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ template <typename... IndexTypes> class dyn_indices_generic {
}

// Reference to underlying sequence
// cppcheck-suppress returnByReference
explicit operator indices_t const&() const { return indices_; }

// Stream output
Expand Down
2 changes: 2 additions & 0 deletions include/libcommute/utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,11 @@ template <> struct print_tuple_impl<0> {
} // namespace detail

template <typename... T>
// cppcheck-suppress constParameterReference
inline void print_tuple(std::ostream& os, std::tuple<T...> const& t) {
detail::print_tuple_impl<sizeof...(T) - 1>::apply(os, t);
}
// cppcheck-suppress constParameterReference
inline void print_tuple(std::ostream& os, std::tuple<> const& t) {}

//
Expand Down
4 changes: 2 additions & 2 deletions test/monomial_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ TEST_CASE("Action of a mixed monomial", "[monomial_action]") {
static std::vector<bit_range_t> bit_ranges = {{2, 3}, {4, 5}};

auto const& bit_range = bit_ranges[ind];
int n_bits = bit_range.second - bit_range.first + 1;
int n_max = (1 << n_bits) - 1;
int const n_bits = bit_range.second - bit_range.first + 1;
int const n_max = (1 << n_bits) - 1;

std::bitset<total_n_bits> in_bitset(index);

Expand Down
4 changes: 2 additions & 2 deletions test/monomial_action_boson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ TEST_CASE("Action of a bosonic monomial on an index",
bool dagger = dynamic_cast<generator_boson<int> const&>(g).dagger();

auto const& bit_range = bit_ranges[ind];
int n_bits = bit_range.second - bit_range.first + 1;
int n_max = (1 << n_bits) - 1;
int const n_bits = bit_range.second - bit_range.first + 1;
int const n_max = (1 << n_bits) - 1;

std::bitset<total_n_bits> in_bitset(index);

Expand Down

0 comments on commit 1689c86

Please sign in to comment.