[cfe-commits] r145697 - in /cfe/trunk: include/clang/Analysis/Analyses/FormatString.h lib/Analysis/FormatString.cpp lib/Analysis/PrintfFormatString.cpp lib/Sema/SemaChecking.cpp test/Sema/format-strings-int-typedefs.c

Hans Wennborg hans at chromium.org
Mon Dec 5 10:08:06 PST 2011


On Mon, Dec 5, 2011 at 5:56 PM, Ted Kremenek <kremenek at apple.com> wrote:
> On Dec 5, 2011, at 5:45 AM, Hans Wennborg wrote:
>
> Suggesting it when it's not defined is not great, but I'm not sure
> it's actually that bad either?
>
>
> I don't think most users would look kindly on a FixIt that turn a compiler
> warning into a compilation error.  I don't think we should unconditionally
> add the FixIt because of this.

The fixit suggests changing the format specifier, not the type of the
argument. Maybe I chose my words poorly. The warning is not
"suggesting" size_t, it's merely pointing out that it was expecting a
size_t parameter. Like this:

a.c:4:13: warning: conversion specifies type 'size_t' but the argument
has type 'double' [-Wformat]
  printf("%zu", 1.0);
          ~~^   ~~~
          %f

 - Hans




More information about the cfe-commits mailing list