From nobody Sat Sep 28 09:48:45 2024 X-Original-To: dev-commits-ports-branches@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 4XG2bL0MH7z5X5CQ; Sat, 28 Sep 2024 09:48:46 +0000 (UTC) (envelope-from git@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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XG2bK63Kkz41W1; Sat, 28 Sep 2024 09:48:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727516925; 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=RTIlmoRnxx/meJdg6BZVXBdK4oPECmMxJ7D7UWfQPFA=; b=pGTb4JGUXycFeeMg2hUWv8Ao5hfMU5IdcjPW8bX7U8klXpMWDNfUWGQ1rMcCDj4KI0LWeg bXyxLDGYuzb0YGPg0AcFRQwT9upX2+SDcltvxYhkuLPT/uKohGBxXo1y6mjwJP3MT2TNsy 1sPRmTAWhulrS42vIdnTgC1kgqMZOM4qNAwcSqmB5KcIlc38MfH81qjMcK1kt2pIf3iv4p wvva4ChSBAXICqmQtrzn8r7CD/4L5oQ3LTDnLb42V4ADZwHEi8tjc1mFdXScibDZi2AHsX tcvWtQbr63zIovATP+SewQOB0LkP6archRRR65EIc/9p1jF0pRK75W/PgRCnWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727516925; 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=RTIlmoRnxx/meJdg6BZVXBdK4oPECmMxJ7D7UWfQPFA=; b=AlZ8ZN859ODyprFTHg4JisK6qDMNheC5j2YK+9C6zzwm4JaNmj81BJ8Pze0NNBYJPAgc6c zMpUiOCFZGzuRb3Wv0ybSkwqPeyzbTdmJ8vrYFIR/cABtzL197udW+MbOI6+JC+dBD+aGl zmE3ZhlNDzwojj4ePiHtW3iUvLUr1hjU6ioopVyfcT4j0ueJK6oQeLPczHGYLiXTBtF4Bj ZD6rs/sco9ty7q73ueqVNSG7j8EHczzXtycUOfPT/7MTD+ymKBQ4PUtNGAFsZTHa6EcsRf /ngguBbrt/w3J1aI5HeOmimXm7sE++lj46oLLrKmkY4bE96WhOAzaSVYsreCfQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727516925; a=rsa-sha256; cv=none; b=BuQG76saD8K4xS7ACWBWl7OgKpMA80eJ9h8UfccpUs9fdzUQ6NQfc8GExjfo22+B8+VOCK LO5kGb9t1fijCPxJZEsRUqQZINZ+7Ek9wBxlEQb8aROPfgNWFJoEFMlCNy4mmpxtPmTQIm TAytLJjSDnzvwoNrVpFUhpZH7AFZeMYtyoTmwDjwxWz163FFvQUgtlRvYabHZsB2oU5Jvo sG9rzof/MBSwmjbecBTOZVHUvHPIzXmWKJBvcPpf1evLGumuXh7KPLaGgXxQZWeTimF79x QZBQCQA4ulzTaoYxrlOII/ypxPYLL6E1RHcnstv8e2Dbmw18R/RJ/vIusn2Ubg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 4XG2bK5NhhzKBL; Sat, 28 Sep 2024 09:48:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 48S9mjBn011560; Sat, 28 Sep 2024 09:48:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48S9mj8L011557; Sat, 28 Sep 2024 09:48:45 GMT (envelope-from git) Date: Sat, 28 Sep 2024 09:48:45 GMT Message-Id: <202409280948.48S9mj8L011557@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-branches@FreeBSD.org From: Dimitry Andric Subject: git: 1a4cfe7f1ee1 - 2024Q3 - audio/libaudiofile: fix build with clang 19, enable tests List-Id: Commits to the quarterly branches of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-branches@freebsd.org Sender: owner-dev-commits-ports-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: ports X-Git-Refname: refs/heads/2024Q3 X-Git-Reftype: branch X-Git-Commit: 1a4cfe7f1ee1ce76987f1455d361032fe456d081 Auto-Submitted: auto-generated The branch 2024Q3 has been updated by dim: URL: https://cgit.FreeBSD.org/ports/commit/?id=1a4cfe7f1ee1ce76987f1455d361032fe456d081 commit 1a4cfe7f1ee1ce76987f1455d361032fe456d081 Author: Dimitry Andric AuthorDate: 2024-09-13 09:11:45 +0000 Commit: Dimitry Andric CommitDate: 2024-09-28 09:48:23 +0000 audio/libaudiofile: fix build with clang 19, enable tests Clang 19 has become more strict about initialization with undefined behavior, resulting in errors similar to: ./SimpleModule.h:126:40: error: in-class initializer for static data member is not a constant expression 126 | static const int kMinSignedValue = -1 << kScaleBits; | ~~~^~~~~~~~~~~~~ ./SimpleModule.h:176:22: note: in instantiation of template class 'signConverter' requested here 176 | transform::signedToUnsigned>(src, dst, count); | ^ ./SimpleModule.h:183:5: note: in instantiation of function template specialization 'ConvertSign::convertSignedToUnsigned' requested here 183 | convertSignedToUnsigned(src, dst, count); | ^ This is because left-shifting negative values is undefined. Replace -1 with ~0u which results in the expected value. While here, add a few other patches to remove warnings about undefined left-shifts, and add support for the "make test" target. PR: 281477 Approved by: maintainer timeout (2 weeks) MFH: 2024Q3 (cherry picked from commit 7955b1d7ec787bf13f2cfea75e9355a3f3e91a53) --- audio/libaudiofile/Makefile | 3 +++ audio/libaudiofile/files/patch-gtest_gtest.h | 11 ++++++++ .../patch-libaudiofile_modules_SimpleModule.h | 11 ++++++++ audio/libaudiofile/files/patch-test_FloatToInt.cpp | 11 ++++++++ audio/libaudiofile/files/patch-test_IntToFloat.cpp | 11 ++++++++ audio/libaudiofile/files/patch-test_NeXT.cpp | 29 ++++++++++++++++++++++ audio/libaudiofile/files/patch-test_Sign.cpp | 20 +++++++++++++++ 7 files changed, 96 insertions(+) diff --git a/audio/libaudiofile/Makefile b/audio/libaudiofile/Makefile index db5302bbe380..a7b2087ee54a 100644 --- a/audio/libaudiofile/Makefile +++ b/audio/libaudiofile/Makefile @@ -23,6 +23,9 @@ USE_LDCONFIG= yes GNU_CONFIGURE= yes GNU_CONFIGURE_MANPREFIX=${PREFIX}/share +do-test: + cd ${WRKSRC} && ${MAKE} check + post-install: @${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libaudiofile.so.1 diff --git a/audio/libaudiofile/files/patch-gtest_gtest.h b/audio/libaudiofile/files/patch-gtest_gtest.h new file mode 100644 index 000000000000..d5e97a6b529b --- /dev/null +++ b/audio/libaudiofile/files/patch-gtest_gtest.h @@ -0,0 +1,11 @@ +--- gtest/gtest.h.orig 2013-02-11 17:23:26 UTC ++++ gtest/gtest.h +@@ -529,7 +529,7 @@ + // feature depending on tuple with be disabled in this mode). + #ifndef GTEST_HAS_TR1_TUPLE + // The user didn't tell us not to do it, so we assume it's OK. +-# define GTEST_HAS_TR1_TUPLE 1 ++# define GTEST_HAS_TR1_TUPLE 0 + #endif // GTEST_HAS_TR1_TUPLE + + // Determines whether Google Test's own tr1 tuple implementation diff --git a/audio/libaudiofile/files/patch-libaudiofile_modules_SimpleModule.h b/audio/libaudiofile/files/patch-libaudiofile_modules_SimpleModule.h new file mode 100644 index 000000000000..641e80136ddf --- /dev/null +++ b/audio/libaudiofile/files/patch-libaudiofile_modules_SimpleModule.h @@ -0,0 +1,11 @@ +--- libaudiofile/modules/SimpleModule.h.orig 2013-03-06 05:30:03 UTC ++++ libaudiofile/modules/SimpleModule.h +@@ -123,7 +123,7 @@ struct signConverter + typedef typename IntTypes::UnsignedType UnsignedType; + + static const int kScaleBits = (Format + 1) * CHAR_BIT - 1; +- static const int kMinSignedValue = -1 << kScaleBits; ++ static const int kMinSignedValue = ~0u << kScaleBits; + + struct signedToUnsigned : public std::unary_function + { diff --git a/audio/libaudiofile/files/patch-test_FloatToInt.cpp b/audio/libaudiofile/files/patch-test_FloatToInt.cpp new file mode 100644 index 000000000000..887337422410 --- /dev/null +++ b/audio/libaudiofile/files/patch-test_FloatToInt.cpp @@ -0,0 +1,11 @@ +--- test/FloatToInt.cpp.orig 2013-02-11 17:23:26 UTC ++++ test/FloatToInt.cpp +@@ -115,7 +115,7 @@ TEST_F(FloatToIntTest, Int16) + EXPECT_EQ(readData[i], expectedData[i]); + } + +-static const int32_t kMinInt24 = -1<<23; ++static const int32_t kMinInt24 = ~0u<<23; + static const int32_t kMaxInt24 = (1<<23) - 1; + + TEST_F(FloatToIntTest, Int24) diff --git a/audio/libaudiofile/files/patch-test_IntToFloat.cpp b/audio/libaudiofile/files/patch-test_IntToFloat.cpp new file mode 100644 index 000000000000..639526afe275 --- /dev/null +++ b/audio/libaudiofile/files/patch-test_IntToFloat.cpp @@ -0,0 +1,11 @@ +--- test/IntToFloat.cpp.orig 2013-02-11 17:23:26 UTC ++++ test/IntToFloat.cpp +@@ -117,7 +117,7 @@ TEST_F(IntToFloatTest, Int16) + EXPECT_EQ(readData[i], expectedData[i]); + } + +-static const int32_t kMinInt24 = -1<<23; ++static const int32_t kMinInt24 = ~0u<<23; + static const int32_t kMaxInt24 = (1<<23) - 1; + + TEST_F(IntToFloatTest, Int24) diff --git a/audio/libaudiofile/files/patch-test_NeXT.cpp b/audio/libaudiofile/files/patch-test_NeXT.cpp new file mode 100644 index 000000000000..aaff4de4ceaa --- /dev/null +++ b/audio/libaudiofile/files/patch-test_NeXT.cpp @@ -0,0 +1,29 @@ +--- test/NeXT.cpp.orig 2013-02-11 17:23:26 UTC ++++ test/NeXT.cpp +@@ -37,7 +37,7 @@ + + #include "TestUtilities.h" + +-const char kDataUnspecifiedLength[] = ++const unsigned char kDataUnspecifiedLength[] = + { + '.', 's', 'n', 'd', + 0, 0, 0, 24, // offset of 24 bytes +@@ -57,7 +57,7 @@ const char kDataUnspecifiedLength[] = + 0, 55 + }; + +-const char kDataTruncated[] = ++const unsigned char kDataTruncated[] = + { + '.', 's', 'n', 'd', + 0, 0, 0, 24, // offset of 24 bytes +@@ -152,7 +152,7 @@ TEST(NeXT, Truncated) + ASSERT_EQ(::unlink(testFileName.c_str()), 0); + } + +-const char kDataZeroChannels[] = ++const unsigned char kDataZeroChannels[] = + { + '.', 's', 'n', 'd', + 0, 0, 0, 24, // offset of 24 bytes diff --git a/audio/libaudiofile/files/patch-test_Sign.cpp b/audio/libaudiofile/files/patch-test_Sign.cpp new file mode 100644 index 000000000000..04c521685a7f --- /dev/null +++ b/audio/libaudiofile/files/patch-test_Sign.cpp @@ -0,0 +1,20 @@ +--- test/Sign.cpp.orig 2013-02-11 17:23:26 UTC ++++ test/Sign.cpp +@@ -116,7 +116,7 @@ TEST_F(SignConversionTest, Int16) + EXPECT_EQ(readData[i], expectedData[i]); + } + +-static const int32_t kMinInt24 = -1<<23; ++static const int32_t kMinInt24 = ~0u<<23; + static const int32_t kMaxInt24 = (1<<23) - 1; + static const uint32_t kMaxUInt24 = (1<<24) - 1; + +@@ -157,7 +157,7 @@ TEST_F(SignConversionTest, Int32) + AFframecount framesRead = afReadFrames(file, AF_DEFAULT_TRACK, readData, frameCount); + ASSERT_EQ(framesRead, frameCount); + afCloseFile(file); +- const uint32_t expectedData[] = { 0, -kMinInt32, kMaxUInt32 }; ++ const uint32_t expectedData[] = { 0, -static_cast(kMinInt32), kMaxUInt32 }; + for (int i=0; i