[cfe-commits] [Patch] Teach format string analysis that "%zu" means size_t.

Hans Wennborg hans at chromium.org
Thu Oct 27 01:44:06 PDT 2011


On Thu, Oct 27, 2011 at 4:48 AM, Ted Kremenek <kremenek at apple.com> wrote:
> Looks good to me.

Thanks! Landed in r143099.

>
> On Oct 26, 2011, at 9:07 AM, Hans Wennborg wrote:
>
>> Hi all,
>>
>> The attached patch teaches format string analysis that "%zu" means size_t.
>>
>> The code had it backwards, thinking size_t was signed, and using that for "%zd".
>>
>> Also let the analysis get the types for (u)intmax_t while we are at it.
>>
>> Please take a look and let me know if this is ok to land.
>>
>> Any ideas for the remaining FIXMEs in PrintfFormatString.cpp, i.e. how
>> to get a hold of a type that's the same width as size_t, but signed
>> would be appreciated. (And the same for unsigned version of ptrdiff_t,
>> though I suppose that is less common.)
>>
>> It would also be cool if the warning could say "conversion specifies
>> type 'size_t' (a.k.a. 'unsigned long')", rather than just using the
>> underlying type, but that's probably for another patch.
>>
>> Thanks,
>> Hans
>> _______________________________________________
>> 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