Jarkko Hietaniemi <jhi@iki.fi> writes: > -Wall -ansi -pedantic -Wtraditional -Wstrict-prototypes > -Wmissing-prototypes -Winline -Wredundant-decls -Wnested-externs > -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings > -Wconversion -Waggregate-return -Winline > The only problem with that is that many system headers do not escape > unscathed :-) -ansi is very difficult to use in practice because it enables various settings in gcc that cause many symbols normally visible in system header files to disappear. One then has to start playing with the various feature test macros (_POSIX_SOURCE, _XOPEN_SOURCE, etc.) in order to get them to come back, with inconsistent and frustrating results on various platforms. I'd love to be able to use -ansi for my source, but I'm not sure it's practical. I generally add -W, although that requires then tagging unused parameters to functions with the appropriate __attribute__, and can cause noise if you use setjmp/longjmp. I add -Wbad-function-cast. -Wconversion I find interesting, but it can be hard to live with and can require adding casts that really aren't necessary in order to silence the compiler (and therefore uglification of code to a degree). It's worth noting that -Wtraditional is specifically recommended only for use when converting a large code base from K&R to ANSI C. If you're assuming ANSI C, the recommendation is to not use it, since it complains about things that are perfectly valid ANSI C and the best way of writing some constructs. I don't believe that the list in the gcc info page of what this turns on is actually comprehensive. -- Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>Thread Previous | Thread Next