Skip to contentSkip to conversation

bindings: cxx: fix sign-compare compile warnings in tests

PATCH Applied Kent Gibson 2 participants 2 messages Jul 1, 2020 – Jul 7, 2020 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bindings: cxx: fix sign-compare compile warnings in tests

Fix sign-compare compile warnings in cxx tests.

---

Just noticed these warnings while rebuilding in a fresh build environment. Not sure if they were triggered by an enviromental change, or if I just wasn't paying enough attention before, but either way this patch makes the compiler happier.

 bindings/cxx/tests/tests-iter.cpp | 2 +-
 bindings/cxx/tests/tests-line.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
bindings/cxx/tests/tests-iter.cpp +1 -1
index fdc2cb5..4c07613 100644
@@ -53,7 +53,7 @@ TEST_CASE("Line iterator works", "[iter][line]")
 {
 	mockup::probe_guard mockup_chips({ 4 });
 	::gpiod::chip chip(mockup::instance().chip_name(0));
-	int count = 0;
+	unsigned int count = 0;
 
 	for (auto& it: ::gpiod::line_iter(chip))
 		REQUIRE(it.offset() == count++);
bindings/cxx/tests/tests-line.cpp +1 -1
index 5353093..e2e4cbc 100644
@@ -210,7 +210,7 @@ TEST_CASE("Line bulk object works correctly", "[line][bulk]")
 	SECTION("bulk iterator works")
 	{
 		auto lines = chip.get_all_lines();
-		int count = 0;
+		unsigned int count = 0;
 
 		for (auto& it: lines)
 			REQUIRE(it.offset() == count++);

base-commit: b56d6b6a452e47fee8c70514afb99ccd77ada677

Signature · 1 line
2.27.0
#1 lore raw
Quoted 42 lines · Kent Gibson

Fix sign-compare compile warnings in cxx tests.

---

Just noticed these warnings while rebuilding in a fresh build environment. Not sure if they were triggered by an enviromental change, or if I just wasn't paying enough attention before, but either way this patch makes the compiler happier.

 bindings/cxx/tests/tests-iter.cpp | 2 +-
 bindings/cxx/tests/tests-line.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
bindings/cxx/tests/tests-iter.cpp +1 -1
index fdc2cb5..4c07613 100644
@@ -53,7 +53,7 @@ TEST_CASE("Line iterator works", "[iter][line]")
 {
        mockup::probe_guard mockup_chips({ 4 });
        ::gpiod::chip chip(mockup::instance().chip_name(0));
-       int count = 0;
+       unsigned int count = 0;
 
        for (auto& it: ::gpiod::line_iter(chip))
                REQUIRE(it.offset() == count++);
bindings/cxx/tests/tests-line.cpp +1 -1
index 5353093..e2e4cbc 100644
@@ -210,7 +210,7 @@ TEST_CASE("Line bulk object works correctly", "[line][bulk]")
        SECTION("bulk iterator works")
        {
                auto lines = chip.get_all_lines();
-               int count = 0;
+               unsigned int count = 0;
 
                for (auto& it: lines)
                        REQUIRE(it.offset() == count++);
Quoted 4 lines

base-commit: b56d6b6a452e47fee8c70514afb99ccd77ada677 --
2.27.0

Applied, thanks!

Bartosz