http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60287
Bug ID: 60287 Summary: Various issues on -Wformat= Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: chengniansun at gmail dot com 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? 2) Is the warning name "[-Wformat=]" in the warning message intended? $: gcc-trunk -Wformat=3 s.c s.c: In function ‘main’: s.c:4:3: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=] printf("%s%s", i, i); ^ s.c:4:3: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat=] $: 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? Currently clang warns at the argument. $: clang-trunk -Wall s.c s.c:4:18: warning: format specifies type 'char *' but the argument has type 'int' [-Wformat] printf("%s%s", i, i); ~~ ^ %d s.c:4:21: warning: format specifies type 'char *' but the argument has type 'int' [-Wformat] printf("%s%s", i, i); ~~ ^ %d 2 warnings generated. $