From nobody Wed May 03 14:00:41 2023 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QBJWF6JcDz49Mxr for ; Wed, 3 May 2023 14:00:41 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QBJWF4dyHz3x8s for ; Wed, 3 May 2023 14:00:41 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683122441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=e0q/ydLMCNnwzDNw1EavedWn1EEKCBzJRdJcmJH1Tec=; b=fMQkQzEBvipS/CQq/X0309XfjDQ9CLspXDK+vVwtoPZBEED2E+xTBBirUgpw1c2iNrHhD7 +P+EZ4t2M6+idmGgBfOkDbMLCTCtVA9Z6gQVadaHC24eZ9aEReY265mGtW78vweVJbY8eD 4/P6Nt977iN2a36WR1GAaxnjJ71zW1hT1XNatVCYLyJGoKT+wUGLjKgYNyG6Ti7HqOvwzi xcstEbPPVmfh5qge0YzIQUAXafM6+KIVwhNMJJkE8TjU6vrQomY/2r5IxyjoDrAds5dRjo BgHGBaPpmDSo29LW5+tXRCkaqeAWI9DqKopEuI3BIlTo5ec9p6j9p6HCqgpSRg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1683122441; a=rsa-sha256; cv=none; b=nWOt74soDj1+OMChaoKkgQrHoobrkSBoFDNwAkm4NVkJOIXM9rigfwn7vJQKCZSiGu915F TuPAPY5zhIJiqKJBMuou35WAWTSpMpRt7Fd3GtGEGQIiHv8bRb86JyJiNiKI0IwnYbYmxu cgClcm23OKTPSrswmKfrEaWEKu6uc7PKWw+8zgARLIemfDCz8vSeATJ3BxEOHh6xIqOPxP JPL4DIwjrLsBbl0q8ouN39N/upCmJbxEohVuvjqbPPY5U+HeVKPBpZJoQzB3mZ8c6AkvxF NJ/vUNDEg2dkJNDzwd6WSO+4o5DDtoGJP2/mki2qLfoJ0xJqiyHa/o5aONbplw== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QBJWF3kB1zXx7 for ; Wed, 3 May 2023 14:00:41 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 343E0fYK037378 for ; Wed, 3 May 2023 14:00:41 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 343E0fCY037377 for bugs@FreeBSD.org; Wed, 3 May 2023 14:00:41 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 271227] ATF_REQUIRE_EQ cannot be used with static_cast(NULL) Date: Wed, 03 May 2023 14:00:41 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: misc X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: emaste@freebsd.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271227 Bug ID: 271227 Summary: ATF_REQUIRE_EQ cannot be used with static_cast(NULL) Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: misc Assignee: bugs@FreeBSD.org Reporter: emaste@freebsd.org In contrib/atf/atf-c/macros.h we have: #define ATF_REQUIRE_EQ(expected, actual) \ ATF_REQUIRE_MSG((expected) =3D=3D (actual), "%s !=3D %s", #expected, #a= ctual) #define ATF_REQUIRE_STREQ(expected, actual) \ ATF_REQUIRE_MSG(strcmp(expected, actual) =3D=3D 0, "%s !=3D %s (%s !=3D= %s)", \ #expected, #actual, expected, actual) ATF_REQUIRE_EQ tests that the (arbitrary) arguments are equal, while ATF_REQUIRE_STREQ compares (and prints differing) strings. In contrast, in contrib/atf/atf-c++/macros.hpp we have only ATF_REQUIRE_EQ: #define ATF_REQUIRE_EQ(expected, actual) \ do { \ if ((expected) !=3D (actual)) { \ std::ostringstream atfu_ss; \ atfu_ss << "Line " << __LINE__ << ": " \ << #expected << " !=3D " << #actual \ << " (" << (expected) << " !=3D " << (actual) << ")"; \ atf::tests::tc::fail(atfu_ss.str()); \ } \ } while (false) In lib/libnv/tests/cnv_tests.cc we have: ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie), static_cast(NULL)); which GCC warns will pass NULL to a fn with a nonnull arg: In file included from /usr/obj/tmp/cirrus-ci-build/amd64.amd64/tmp/usr/include/c++/v1/string:536: In static member function 'static constexpr size_t std::__1::char_traits::length(const char_type*)', inlined from 'std::__1::basic_ostream& std::__1::operator<<(basic_ostream&, const char*) [with _Tra= its =3D char_traits]' at /usr/obj/tmp/cirrus-ci-build/amd64.amd64/tmp/usr/include/c++/v1/ostream:902= :43, inlined from 'virtual void {anonymous}::atfu_tc_cnvlist_free_nvlist_array::body() const' at /tmp/cirrus-ci-build/lib/libnv/tests/cnv_tests.cc:1438:3: /usr/obj/tmp/cirrus-ci-build/amd64.amd64/tmp/usr/include/c++/v1/__string/ch= ar_traits.h:218:30: warning: argument 1 null where non-null expected [-Wnonnull] 218 | return __builtin_strlen(__s); | ~~~~~~~~~~~~~~~~^~~~~ --=20 You are receiving this mail because: You are the assignee for the bug.=