[LLVMbugs] [Bug 9751] New: -Wformat doesn't point to the callsite when format string is a variable

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 19 11:07:24 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=9751

           Summary: -Wformat doesn't point to the callsite when format
                    string is a variable
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: matthewbg at google.com
                CC: llvmbugs at cs.uiuc.edu


$ cat testcases/format.c
#include <stdio.h>

const char kFormatStr[] = "%d %s\n";

void f() {
  printf(kFormatStr, 0);
  printf(kFormatStr, 1);
}
$ clang -fsyntax-only -Wformat testcases/format.c
testcases/format.c:3:32: warning: more '%' conversions than data arguments
[-Wformat]
const char kFormatStr[] = "%d %s\n";
                              ~^
testcases/format.c:3:32: warning: more '%' conversions than data arguments
[-Wformat]
const char kFormatStr[] = "%d %s\n";
                              ~^

So, we correctly identify the extra conversion specifier, but don't print any
source location information for the callsites that are missing arguments! In
this case, I'd prefer for the primary source location to be the callsite, with
the format string definition given in a note.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list