forked from Lainports/freebsd-ports
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<kInt8>' requested here
176 | transform<typename signConverter<Format>::signedToUnsigned>(src, dst, count);
| ^
./SimpleModule.h:183:5: note: in instantiation of function template specialization 'ConvertSign::convertSignedToUnsigned<kInt8>' requested here
183 | convertSignedToUnsigned<kInt8>(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
29 lines
701 B
C++
29 lines
701 B
C++
--- 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
|