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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


$ 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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to