Date: Sun, 26 Oct 2025 04:13:46 GMT From: Colin Percival <cperciva@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 595ddf009a03 - releng/15.0 - inet_net_test: Compare pointers against nullptr Message-ID: <202510260413.59Q4DkNh077554@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch releng/15.0 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=595ddf009a0371dfa7fe851349fe79423018259d commit 595ddf009a0371dfa7fe851349fe79423018259d Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2025-10-20 18:31:41 +0000 Commit: Colin Percival <cperciva@FreeBSD.org> CommitDate: 2025-10-26 04:13:20 +0000 inet_net_test: Compare pointers against nullptr GCC does not like passing NULL (__null) to std::ostringstream::operator<< inside of ATF_REQUIRE_EQ: lib/libc/tests/net/inet_net_test.cc: In member function 'virtual void {anonymous}::atfu_tc_inet_net_ntop_invalid::body() const': lib/libc/tests/net/inet_net_test.cc:306:9: error: passing NULL to non-pointer argument 1 of 'std::__1::basic_ostream<_CharT, _Traits>& std::__1::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::__1::char_traits<char>]' [-Werror=conversion-null] 306 | ATF_REQUIRE_EQ(ret, NULL); | ^~~~~~~~~~~~~~ In file included from /usr/obj/.../amd64.amd64/tmp/usr/include/c++/v1/sstream:317, from /usr/obj/.../amd64.amd64/tmp/usr/include/atf-c++/macros.hpp:29, from /usr/obj/.../amd64.amd64/tmp/usr/include/atf-c++.hpp:29, from lib/libc/tests/net/inet_net_test.cc:33: /usr/obj/.../amd64.amd64/tmp/usr/include/c++/v1/__ostream/basic_ostream.h:338:81: note: declared here 338 | basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long __n) { | ~~~~~^~~ ... Approved by: re (cperciva) Fixes: 8f4a0d2f7b96 ("libc: Import OpenBSD's inet_net_{ntop,pton}") (cherry picked from commit aa358ce3ca8e1fcfb305025fd00beb2a119c7c77) (cherry picked from commit 848ca53d3a44ed58348878de462e4c86daa24e5e) --- lib/libc/tests/net/inet_net_test.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/libc/tests/net/inet_net_test.cc b/lib/libc/tests/net/inet_net_test.cc index 4ecf5a3de492..50687cac006a 100644 --- a/lib/libc/tests/net/inet_net_test.cc +++ b/lib/libc/tests/net/inet_net_test.cc @@ -303,25 +303,25 @@ ATF_TEST_CASE_BODY(inet_net_ntop_invalid) std::ranges::fill(strbuf, 'Z'); auto ret = inet_net_ntop(AF_INET6, &addr6, 128, strbuf.data(), 1); - ATF_REQUIRE_EQ(ret, NULL); + ATF_REQUIRE_EQ(ret, nullptr); ATF_REQUIRE_EQ(strbuf[1], 'Z'); std::ranges::fill(strbuf, 'Z'); ret = inet_net_ntop(AF_INET, &addr4, 32, strbuf.data(), 1); - ATF_REQUIRE_EQ(ret, NULL); + ATF_REQUIRE_EQ(ret, nullptr); ATF_REQUIRE_EQ(strbuf[1], 'Z'); /* Check that invalid prefix lengths return an error */ ret = inet_net_ntop(AF_INET6, &addr6, 129, strbuf.data(), strbuf.size()); - ATF_REQUIRE_EQ(ret, NULL); + ATF_REQUIRE_EQ(ret, nullptr); ret = inet_net_ntop(AF_INET6, &addr6, -1, strbuf.data(), strbuf.size()); - ATF_REQUIRE_EQ(ret, NULL); + ATF_REQUIRE_EQ(ret, nullptr); ret = inet_net_ntop(AF_INET, &addr4, 33, strbuf.data(), strbuf.size()); - ATF_REQUIRE_EQ(ret, NULL); + ATF_REQUIRE_EQ(ret, nullptr); ret = inet_net_ntop(AF_INET, &addr4, -1, strbuf.data(), strbuf.size()); - ATF_REQUIRE_EQ(ret, NULL); + ATF_REQUIRE_EQ(ret, nullptr); } ATF_INIT_TEST_CASES(tcs)home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202510260413.59Q4DkNh077554>
