> Oliver St?neberg wrote: > > > I finally got around to trying to update FLAC for the MAME/MESS > > project again. There were several issues I was able to fix and will > > submit patches later, but I hit one roadblock with GCC and clang: > > > > src/lib/libflac/libFLAC/stream_encoder.c:1696:43: error: cast from function call > > of type 'double' to non-matching type 'FLAC__int32' (aka 'int') > > [-Werror,-Wbad-function-cast] > > ...FLAC__int32 tukey_parts = (FLAC__int32)strtod(specification+14, 0); > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > > src/lib/libflac/libFLAC/stream_encoder.c:1717:43: error: cast from function call > > of type 'double' to non-matching type 'FLAC__int32' (aka 'int') > > [-Werror,-Wbad-function-cast] > > ...FLAC__int32 tukey_parts = (FLAC__int32)strtod(specification+15, 0); > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > > 2 errors generated. > > What build system are you using and what versions of GCC and Clang? > What OS?clang 3.5 on ubuntu 14.04 and GCC (MinGW-w64) 4.9.1 on Windows 7.> > Apparently you are supposed to round() or floor() instead of just > > casting a double to an integer. > > Sorry, thats not correct, strtod() returns double and the type signatures > of round and floor are as follows: > > double round(double x); > double floor(double x); > > so you have to cast anyway.Alright...stupid me. I just don't use mathematical functions very often...
Oliver St?neberg wrote:> > > Oliver St?neberg wrote: > > > > > I finally got around to trying to update FLAC for the MAME/MESS > > > project again. There were several issues I was able to fix and will > > > submit patches later, but I hit one roadblock with GCC and clang: > > > > > > src/lib/libflac/libFLAC/stream_encoder.c:1696:43: error: cast from function call > > > of type 'double' to non-matching type 'FLAC__int32' (aka 'int') > > > [-Werror,-Wbad-function-cast] > > > ...FLAC__int32 tukey_parts = (FLAC__int32)strtod(specification+14, 0); > > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > src/lib/libflac/libFLAC/stream_encoder.c:1717:43: error: cast from function call > > > of type 'double' to non-matching type 'FLAC__int32' (aka 'int') > > > [-Werror,-Wbad-function-cast] > > > ...FLAC__int32 tukey_parts = (FLAC__int32)strtod(specification+15, 0); > > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > 2 errors generated. > > > > What build system are you using and what versions of GCC and Clang? > > What OS? > > clang 3.5 on ubuntu 14.04 and GCC (MinGW-w64) 4.9.1 on Windows 7.You still didn't sat which build system. The reason I ask is that if you were building using one of the build systems shipped with FLAC, there would not be a path like src/lib/libflac/libFLAC/stream_encoder.c which suggests that you imported the FLAC sources into your own source tree and your building it with your own build system. Sorry, but we cannot support your custom build system :-). Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
> Oliver St?neberg wrote: > > > > > > Oliver St?neberg wrote: > > > > > > > I finally got around to trying to update FLAC for the MAME/MESS > > > > project again. There were several issues I was able to fix and will > > > > submit patches later, but I hit one roadblock with GCC and clang: > > > > > > > > src/lib/libflac/libFLAC/stream_encoder.c:1696:43: error: cast from function call > > > > of type 'double' to non-matching type 'FLAC__int32' (aka 'int') > > > > [-Werror,-Wbad-function-cast] > > > > ...FLAC__int32 tukey_parts = (FLAC__int32)strtod(specification+14, 0); > > > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > src/lib/libflac/libFLAC/stream_encoder.c:1717:43: error: cast from function call > > > > of type 'double' to non-matching type 'FLAC__int32' (aka 'int') > > > > [-Werror,-Wbad-function-cast] > > > > ...FLAC__int32 tukey_parts = (FLAC__int32)strtod(specification+15, 0); > > > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > 2 errors generated. > > > > > > What build system are you using and what versions of GCC and Clang? > > > What OS? > > > > clang 3.5 on ubuntu 14.04 and GCC (MinGW-w64) 4.9.1 on Windows 7. > > > You still didn't sat which build system. The reason I ask is that > if you were building using one of the build systems shipped with FLAC, > there would not be a path like > > src/lib/libflac/libFLAC/stream_encoder.c > > which suggests that you imported the FLAC sources into your own source > tree and your building it with your own build system. > > Sorry, but we cannot support your custom build system :-).Sorry...overlooked that. Yes, it is a custom build system, but what does have to do with the code causing a warning with GCC/clang, that is enabled by default? Unless you disable this warning in your build system. Just using autoconf or cmake instead of gcc/clang directly doesn't make them compiler behave differently - unless you tell them to ;)