git: e1aeb58cbbc3 - main - inet_net_test: Use int to hold expected return values from inet_net_pton

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Mon, 20 Oct 2025 18:32:12 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=e1aeb58cbbc3839db93ec38ce491b7b9383d5649

commit e1aeb58cbbc3839db93ec38ce491b7b9383d5649
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-10-20 18:31:41 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-10-20 18:31:41 +0000

    inet_net_test: Use int to hold expected return values from inet_net_pton
    
    GCC warns about the sign mismatch in comparisons:
    
    lib/libc/tests/net/inet_net_test.cc: In member function 'virtual void {anonymous}::atfu_tc_inet_net_inet4::body() const':
    lib/libc/tests/net/inet_net_test.cc:86:17: error: comparison of integer expressions of different signedness: 'int' and 'const unsigned int' [-Werror=sign-compare]
       86 |                 ATF_REQUIRE_EQ(bits, addr.bits);
          |                 ^~~~~~~~~~~~~~
    lib/libc/tests/net/inet_net_test.cc: In member function 'virtual void {anonymous}::atfu_tc_inet_net_inet6::body() const':
    lib/libc/tests/net/inet_net_test.cc:205:17: error: comparison of integer expressions of different signedness: 'int' and 'const unsigned int' [-Werror=sign-compare]
      205 |                 ATF_REQUIRE_EQ(bits, addr.bits);
          |                 ^~~~~~~~~~~~~~
    
    Fixes:          8f4a0d2f7b96 ("libc: Import OpenBSD's inet_net_{ntop,pton}")
---
 lib/libc/tests/net/inet_net_test.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/libc/tests/net/inet_net_test.cc b/lib/libc/tests/net/inet_net_test.cc
index 4ecf5a3de492..c4411373165e 100644
--- a/lib/libc/tests/net/inet_net_test.cc
+++ b/lib/libc/tests/net/inet_net_test.cc
@@ -50,7 +50,7 @@ ATF_TEST_CASE_BODY(inet_net_inet4)
 
 	struct test_addr {
 		std::string input;
-		unsigned bits;
+		int bits;
 		std::string output;
 	};
 
@@ -134,7 +134,7 @@ ATF_TEST_CASE_BODY(inet_net_inet6)
 
 	struct test_addr {
 		std::string input;
-		unsigned bits;
+		int bits;
 		std::string output;
 	};