[hatari-devel] Compiling Hatari with Clang (from LLVM project) and the resulting signed comparison warnings

Eero Tamminen eerot at users.berlios.de
Mon May 23 22:19:58 CEST 2011


Hi,

On maanantai 23 toukokuu 2011, Thomas Huth wrote:
> schrieb Eero Tamminen <eerot at users.berlios.de>:
> > (And a huge amount of unused variables & argument warnings from
> > uae-cpu/cpuemu.c.)
> 
> We've got some CMake magic in src/uae-cpu/CMakeLists.txt to disable
> these warnings when compiling with GCC:
> 
> # Generated cpuemu.c contains a lot of warnings we don't really care
> about... if(CMAKE_COMPILER_IS_GNUCC)
> set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-sign-compare -Wno-shadow")
> set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-variable
> -Wno-unused-label") endif(CMAKE_COMPILER_IS_GNUCC)
> 
> I guess this is not triggered for clang anymore?

Never was.   I had to manually add "-Wall -Wextra -Wno-unused-parameter" to
CMake compiler flags get Clang to spit warnings. :-)


> Is there an easy way to detect clang with cmake?

Apparently that support doesn't work very well with Clang as it's recognized
wrong by CMake:
http://www.cmake.org/pipermail/cmake/2010-October/040461.html


> Then you could enhance this if-statement...

Maybe for Hatari v1.6.  By that time BSD might have switched to Clang
as its default compiler, it already can build BSD for x86:
	http://wiki.freebsd.org/BuildingFreeBSDWithClang

So somebody might even contribute the patch for Hatari CMakefile.txt. :-)


While the Hatari version produced by Clang seems to be working OK, I'm
mainly interested about its static analyzer part which isn't something one
would be using every day, so temporary hacks for it should be fine for
now...


	- Eero



More information about the hatari-devel mailing list