[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
Richard Smith
richard at metafoo.co.uk
Mon Dec 5 11:51:52 PST 2011
On Mon, December 5, 2011 18:08, Hans Wennborg wrote:
> 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'm not sure I agree that mentioning size_t is not great. Since %zu means 'an
unsigned integer the same width as size_t', it would be strange to not mention
size_t. One particular case where I'd like to see a good diagnostic is where
the 'real' size_t is not in scope, but an incorrect user-defined size_t is:
a.c:4:13: warning: conversion specifies type 'size_t' (aka 'unsigned int') but
the argument has type 'size_t' (aka 'unsigned long long') [-Wformat]
printf("%zu", sz);
~~^ ~~
%llu
I'm a little worried that the current patch might produce a diagnostic like
this for that case:
a.c:4:13: warning: conversion specifies type 'size_t' but the argument has
type 'size_t' [-Wformat]
- Richard
More information about the cfe-commits
mailing list