On Thu, 22 Apr 2010 15:35:17 +0200 Colomban Wendling lists.ban@herbesfolles.org wrote:
[1] -Wall -W -O2 -Wunused -Wunreachable-code -Wformat=2 -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Wnested-externs -pedantic
BTW, which one causes the const literal string warnings?
-Wwrite-strings. It makes string literals explicitly constant so such an implicit cast is found.
Oh thanks, I scanned through for a string warning but there must be a bug in my brain's grep function ;-)
Ah, as we talk about compiler options, another think I like to add is -Werror-implicit-function-declaration (that, as its name suggests, take an implicit function declaration as an error), since such a situation is most likely a bug in the program; and passing invalid arguments to functions leads to strange bugs too anyway.
It's already enabled for -Wall, according to: http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#Warning-Options
Regards, Nick