http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60287
Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |burnus at gcc dot gnu.org --- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> --- (In reply to Chengnian Sun from comment #0) > 1) Besides "-Wformat=2", gcc accepts any option in the form of > -Wformat=<number> > Based on the manual, gcc only accepts "-Wformat=2", and others such as > "-Wformat=0,1, 3-9" should be invalid. Any undocumented behavior? Well, -Wformat=0 disables all format warnings (not really documented) - and should be equivalent to -Wno-format; "-Wformat=1" is equivalent to "-Wformat" - and that is explicitly documented in the manual: http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wformat-294 And -Wformat=2 is equivalent to -Wformat=1 plus additional warnings. -Wformat=3 would be equivalent to -Wformat=2 plus additional (nonexisting) options. And I think it currently acts as -Wformat=2, which should be fine as well. (Similar is: -O0, -O1, -O2, -O3; where some other compilers have -O4 - but GCC doesn't and [I think it] treats it as -O3.) > 2) Is the warning name "[-Wformat=]" in the warning message intended? Yes - as one doesn't want to distinguish between "-Wformat=2" and "-Wformat/-Wformat=1 -Wformat-security". In particular, "-Wformat-security" requires "-Wformat=1" in addition, otherwise, it doesn't warn at all. Thus, printing [-Wformat=] is way easier than to re-construct the exact option. > 3) Is the column number information correct in the warning message? Should > the warning refer to the location of the problematic argument, or the > function call? Well, the column number is correct - but pointing to either to the proper '%' in the format string or to the argument would be better. - Like always, there is room for improvement.