[hatari-devel] Using more GCC warnings?

Thomas Huth huth at users.berlios.de
Sat Sep 18 01:51:19 CEST 2010


On Sat, 18 Sep 2010 00:20:04 +0300
Eero Tamminen <oak at helsinkinet.fi> wrote:

> Hi,
> 
> I was contemplating adding few more warning options to Hatari
> GCC compilation flags:
> --- a/CMakeLists.txt    Sat Sep 18 00:09:34 2010 +0300
> +++ b/CMakeLists.txt    Sat Sep 18 00:19:17 2010 +0300
> @@ -175,7 +175,8 @@
> -       set(CMAKE_C_FLAGS "-Wall -Wwrite-strings -Wsign-compare 
> ${CMAKE_C_FLAGS}")
> +       set(CMAKE_C_FLAGS "-Wall -Wextra -Wwrite-strings
> ${CMAKE_C_FLAGS}")
> +       set(CMAKE_C_FLAGS "-Wformat-security -DFORTIFY_SOURCE=2 
> ${CMAKE_C_FLAGS}
> 
> See:
> http://wiki.debian.org/Hardening#DEBBUILDHARDENINGFORMAT.28gcc.2BAC8-g.2B-.2B--Wformat-Wformat-security.29
> 
> (-Wextra already include -Wsign-compare check and -Wall includes
> -Wformat.)
> 
> 
> I already fixed couple of things this complains about, but quite a few
> functions would need after -Wextra to be explicitly declared as not
> using all of the arguments given to them.

I personally dislike -Wextra because it generates a lot of annoying
warnings, especially these "unused parameter" warnings. Not using one
of the parameters is perfectly legal C, and often also necessary, e.g.
to meet certain function interface requirements, so I really don't see
the point in polluting the code with those "__unused" keywords. If you
really want additional warnings, I would prefer if you use the
corresponding -Wsomething option directly, and omit -Wunused-parameter
from the list.

 Thomas




More information about the hatari-devel mailing list