From 7955b1d7ec787bf13f2cfea75e9355a3f3e91a53 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Fri, 13 Sep 2024 11:11:45 +0200 Subject: 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 --- .../files/patch-libaudiofile_modules_SimpleModule.h | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 audio/libaudiofile/files/patch-libaudiofile_modules_SimpleModule.h (limited to 'audio/libaudiofile/files/patch-libaudiofile_modules_SimpleModule.h') 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 + { -- cgit v1.2.3