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

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Oct 27 17:48:27 PDT 2011


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

rtrieu at google.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |rtrieu at google.com
         Resolution|                            |FIXED

--- Comment #1 from rtrieu at google.com 2011-10-27 19:48:26 CDT ---
Committed a fix at r143168.

--Source--
#include <stdio.h>

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

void f() {
  printf(kFormatStr, 0);
  printf(kFormatStr, 1);
}

--Clang Messages--
format.c:6:10: warning: more '%' conversions than data arguments [-Wformat]
  printf(kFormatStr, 0);
         ^~~~~~~~~~
format.c:3:32: note: format string is defined here
const char kFormatStr[] = "%d %s\n";
                              ~^
format.c:7:10: warning: more '%' conversions than data arguments [-Wformat]
  printf(kFormatStr, 1);
         ^~~~~~~~~~
format.c:3:32: note: format string is defined here
const char kFormatStr[] = "%d %s\n";
                              ~^
2 warnings generated.

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