lvqcl wrote:> 1) if FLAC__SSE_OS==1 then MSVC cannot compile current cpu.c: > "#include <windows.h>" line is inactive and MSVC complains: > cpu.c(278): error C2065: 'EXCEPTION_EXECUTE_HANDLER': undeclared identifier > cpu.c(279): error C2065: 'STATUS_ILLEGAL_INSTRUCTION': undeclared identifier > > 2) the current code (simplified): > > if(info->ia32.sse) { > #if !FLAC__SSE_OS > /* assume user knows better than us; turn it off */ > disable_sse(info); > #elif ... > #elif defined(__linux__) && !FLAC__SSE_OS > #elif ... > #else > #endif > } > > means that the __linux__ part is never compiled: if FLAC__SSE_OS==0 then > this code becomes just "disable_sse(info);" and if FLAC__SSE_OS==1 > then "defined(__linux__) && !FLAC__SSE_OS" is always false.I think I've fixed both those in: commit 23778a3a6018f5dcb5fc1ad6ac97ad8391afc69d Author: Erik de Castro Lopo <erikd at mega-nerd.com> Date: Sat Jun 25 17:02:06 2016 +1000 libFLAC/cpu.c: More pre-processor cleanups I've tested on this in x86, x86_64, powerpc and armhf linux as well as cross-compiling from linux to x86 and x86_64 Windows. Please test compiling on Windows and anything else you can get your hands on. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
yErik de Castro Lopo wrote:> I think I've fixed both those in: > > commit 23778a3a6018f5dcb5fc1ad6ac97ad8391afc69d > Author: Erik de Castro Lopo <erikd at mega-nerd.com> > Date: Sat Jun 25 17:02:06 2016 +1000 > > libFLAC/cpu.c: More pre-processor cleanups > > > I've tested on this in x86, x86_64, powerpc and armhf linux as well as > cross-compiling from linux to x86 and x86_64 Windows.So if I understand things correctly, the current meaning of --(en|dis)able-sse is: on Linux: --enable-sse: add -msse2 to the compiler switches do not test SSE OS support (assume that SSE is supported) --disable-sse: do NOT add -msse2 test SSE OS support on other OSes: --enable-sse: add -msse2 to the compiler switches test SSE OS support (why?) --disable-sse: do NOT add -msse2 test SSE OS support It's a bit contradictory: why test whether *BSD etc support SSE or not but at the same time allow compiler to use SSE/SSE2 unconditionally? Also: are there any compilers / target OSes such that libFLAC currently has no way to test OS support of SSE? The current code will always disable SSE for such builds: --enable-sse: add -msse2 to the compiler switches disable the use of SSE code --disable-sse: do NOT add -msse2 disable the use of SSE code previously --enable-sse made it possible to override this.> Please test compiling on Windows and anything else you can get your > hands on.Will do. MSVC 2015: builds OK.
First off, this code is horrible to read and work on. The recent commits are the first of what I hope is a massive clean up of this code. lvqcl wrote:> So if I understand things correctly, the current meaning of --(en|dis)able-sse is: > > on Linux: > --enable-sse: > add -msse2 to the compiler switches > do not test SSE OS support (assume that SSE is supported) > --disable-sse: > do NOT add -msse2 > test SSE OS support > > on other OSes: > --enable-sse: > add -msse2 to the compiler switches > test SSE OS support (why?) > --disable-sse: > do NOT add -msse2 > test SSE OS support > > It's a bit contradictory: why test whether *BSD etc support SSE or not > but at the same time allow compiler to use SSE/SSE2 unconditionally?Yes, that needs to be fixed. I think the way it works on Linux makes the most sense.> Also: are there any compilers / target OSes such that libFLAC currently > has no way to test OS support of SSE?No idea. Thats for other people to test and bring to our attention. Adding support for this stuff will become easier after this code is cleaned up.> The current code will always > disable SSE for such builds: > --enable-sse: > add -msse2 to the compiler switches > disable the use of SSE code > --disable-sse: > do NOT add -msse2 > disable the use of SSE code > > previously --enable-sse made it possible to override this.Once this code is cleaned up further improvements are likely.> > Please test compiling on Windows and anything else you can get your > > hands on. > > Will do. > MSVC 2015: builds OK.Great. Thanks. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/