From: Bernd Kuhls Date: Sat, 4 Jun 2016 16:13:52 +0000 (+0200) Subject: package/audiofile: fix compilation with gcc6 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0b69faf716bcf901f59189219d64df56623fa23c;p=buildroot.git package/audiofile: fix compilation with gcc6 Fixes make[3]: Entering directory '/home/buildroot/br7_freeswitch/output/build/audiofile-0.3.6/libaudiofile/modules' /bin/bash ../../libtool --tag=CXX --mode=compile /home/buildroot/br7_freeswitch/output/host/usr/bin/i586-buildroot-linux-uclibc-g++ -DHAVE_CONFIG_H -I. -I../.. -I./.. -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DNDEBUG -Wall -Wno-multichar -fvisibility=hidden -fno-rtti -fno-exceptions -fvisibility-inlines-hidden -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -c -o ALAC.lo ALAC.cpp libtool: compile: /home/buildroot/br7_freeswitch/output/host/usr/bin/i586-buildroot-linux-uclibc-g++ -DHAVE_CONFIG_H -I. -I../.. -I./.. -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DNDEBUG -Wall -Wno-multichar -fvisibility=hidden -fno-rtti -fno-exceptions -fvisibility-inlines-hidden -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -c ALAC.cpp -fPIC -DPIC -o .libs/ALAC.o In file included from ALAC.cpp:29:0: SimpleModule.h: In instantiation of 'const int signConverter<(FormatCode)0>::kMinSignedValue': SimpleModule.h:130:52: required from 'signConverter::UnsignedType signConverter::signedToUnsigned::operator()(signConverter::SignedType) [with FormatCode Format = (FormatCode)0; signConverter::UnsignedType = unsigned char; signConverter::SignedType = signed char]' /home/buildroot/br7_freeswitch/output/host/usr/i586-buildroot-linux-uclibc/include/c++/6.1.0/bits/stl_algo.h:4184:24: required from '_OIter std::transform(_IIter, _IIter, _OIter, _UnaryOperation) [with _IIter = const signed char*; _OIter = unsigned char*; _UnaryOperation = signConverter<(FormatCode)0>::signedToUnsigned]' SimpleModule.h:104:16: required from 'void transform(const void*, void*, size_t) [with UnaryFunction = signConverter<(FormatCode)0>::signedToUnsigned; size_t = unsigned int]' SimpleModule.h:176:62: required from 'static void ConvertSign::convertSignedToUnsigned(const void*, void*, size_t) [with FormatCode Format = (FormatCode)0; size_t = unsigned int]' SimpleModule.h:183:51: required from here SimpleModule.h:126:40: error: left operand of shift expression '(-1 << 7)' is negative [-fpermissive] static const int kMinSignedValue = -1 << kScaleBits; ~~~^~~~~~~~~~~~~ To reproduce the build error use this defconfig: BR2_GCC_VERSION_6_X=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_PACKAGE_AUDIOFILE=y Signed-off-by: Bernd Kuhls Signed-off-by: Thomas Petazzoni --- diff --git a/package/audiofile/0002-cast-to-unsigned-gcc6.patch b/package/audiofile/0002-cast-to-unsigned-gcc6.patch new file mode 100644 index 0000000000..01baeb5e63 --- /dev/null +++ b/package/audiofile/0002-cast-to-unsigned-gcc6.patch @@ -0,0 +1,28 @@ +From 28cfdbbcb96a69087c3d21faf69b5eae7bcf6d69 Mon Sep 17 00:00:00 2001 +From: Hodorgasm +Date: Wed, 11 May 2016 21:42:07 -0400 +Subject: [PATCH] Cast to unsigned while left bit-shifting + +GCC-6 now treats the left bitwise-shift of a negative integer as nonconformant so explicitly cast to an unsigned int while bit-shifting. + +Downloaded from upstream PR: +https://github.com/mpruett/audiofile/pull/28 + +Signed-off-by: Bernd Kuhls +--- + libaudiofile/modules/SimpleModule.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libaudiofile/modules/SimpleModule.h b/libaudiofile/modules/SimpleModule.h +index 03c6c69..4014fb2 100644 +--- a/libaudiofile/modules/SimpleModule.h ++++ b/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 = static_cast(static_cast(-1) << kScaleBits);; + + struct signedToUnsigned : public std::unary_function + {