This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/60287] New: Various issues on -Wformat=


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.
$

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]