[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

John McCall rjmccall at apple.com
Sat Dec 3 20:55:43 PST 2011


On Dec 3, 2011, at 1:37 PM, Joerg Sonnenberger wrote:
> On Sat, Dec 03, 2011 at 10:14:24AM -0800, Douglas Gregor wrote:
>> The warning does need to find the typedef, because it shouldn't suggest
>> 'size_t' if no 'size_t' is visible. However, you can just perform
>> lookup into the translation unit (using DeclContext's lookup) to find
>> an appropriately-typed 'size_t' typedef.
> 
> I disagree on this. %zu should *always* suggest size_t, %ju should
> *always* suggest uintmax_t etc.

I agree, although I also agree that suggesting a type not in scope is
not great.  We could check for the type and suggest the C99 header to
#include if it's not present, though.

John.



More information about the cfe-commits mailing list