build: fix range-loop-analysis warnings

This commit is contained in:
Danny Robson 2020-02-17 17:40:03 +11:00
parent 37899b3f8b
commit 8cdbbcb26e
6 changed files with 14 additions and 7 deletions

View File

@ -66,7 +66,7 @@ namespace cruft::iterator {
zipped_iterator operator++ (int);
auto
decltype(auto)
operator* (void)
{
// We deliberately construct a tuple manually here to reduce

View File

@ -91,7 +91,7 @@ cruft::term::has_csi_support (void)
///////////////////////////////////////////////////////////////////////////////
graphics::graphics (layer _layer, hue _hue):
m_value (_layer + _hue)
m_value (_layer + int (_hue))
{ ; }

View File

@ -8,8 +8,15 @@ int main ()
{
cruft::TAP::logger tap;
tap.expect_nothrow ([] () { cruft::expected<std::string,int> { "foo" }; }, "value construction succeeds");
tap.expect_nothrow ([] () { cruft::expected<std::string,int> { EPERM }; }, "error construction succeeds");
tap.expect_nothrow (
[] () { (void)cruft::expected<std::string,int> { "foo" }; },
"value construction succeeds"
);
tap.expect_nothrow (
[] () { (void)cruft::expected<std::string,int> { EPERM }; },
"error construction succeeds"
);
tap.expect_eq (cruft::expected<std::string,int> { "foo" }.value (), "foo", "value matches");
tap.expect_eq (cruft::expected<std::string,int> { EPERM }.error (), EPERM, "error matches");

View File

@ -106,7 +106,7 @@ void test_bresenham (cruft::TAP::logger &tap)
for (auto const &t: TESTS) {
std::vector<cruft::point2i> computed;
for (auto const &p: cruft::geom::bresenham ({ t.a, t.b }))
for (auto const p: cruft::geom::bresenham ({ t.a, t.b }))
computed.push_back (p);
tap.expect_eq (computed, t.expected, "bresenham: %!", t.message);
}

View File

@ -65,7 +65,7 @@ main (int, char**)
char c_char[] = { '\0', 'b', 'c' };
bool success = true;
for (auto const &[i, v, a, c]: cruft::iterator::izip (v_int, a_float, c_char)) {
for (auto const [i, v, a, c]: cruft::iterator::izip (v_int, a_float, c_char)) {
success = success &&
v_int[i] == v &&
cruft::equal (a_float[i], a) &&

View File

@ -25,7 +25,7 @@ test_transforms (cruft::TAP::logger &tap)
{ "Don't.", "DON'T.", "don't.", "upper and lower and symbols" },
};
for (auto const [src, upper, lower, msg]: TESTS) {
for (auto const &[src, upper, lower, msg]: TESTS) {
tap.expect_eq (cruft::to_upper (src), upper, "to_upper, %!", msg);
tap.expect_eq (cruft::to_lower (src), lower, "to_lower, %!", msg);
}