[cfe-commits] [PATCH] Teach printf warnings about small integer types.

Ted Kremenek kremenek at apple.com
Wed Oct 20 21:05:19 PDT 2010

Hi Justin,

I went ahead applied this patch (with a few modifications) here:


I mainly incorporated my minor nits I commented on in my last email.  I also needed to modify the test case slightly to use 'typedef' instead of '#define'.  Even though they might appear to be correct, please make sure that the test cases actually pass before submitting patches.


On Oct 2, 2010, at 12:49 AM, Justin Bogner wrote:

> Previously, the printf warnings would say your arguments type was
> `int` when it was really a `char` or a `short`. This fixes that and
> allows the hints to suggest `h` modifiers for small ints.
> Typedef'd `char` types are treated as ints, since the most common case
> of uint8_t shouldn't normally be formatted as a character.
> ---
> lib/Analysis/PrintfFormatString.cpp |   16 +++++++++++++++-
> lib/Sema/SemaChecking.cpp           |    6 ++++--
> test/Sema/format-strings.c          |   11 ++++++++++-
> 3 files changed, 29 insertions(+), 4 deletions(-)
> <informative-printf.patch>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

More information about the cfe-commits mailing list