[cfe-commits] [Patch] Make -Wformat walk the typedef chain when looking for size_t etc.

Matt Beaumont-Gay matthewbg at google.com
Fri Jul 27 09:38:26 PDT 2012


LGTM, but maybe Doug or Ted should comment on whether this is actually the
behavior we want.


On Fri, Jul 27, 2012 at 6:17 AM, Hans Wennborg <hans at chromium.org> wrote:

> Hi all,
>
> Clang's -Wformat fix-its currently suggest using "%zu" for values of
> type size_t (in C99 and C++11).
>
> However, for a type such as std::vector<T>::size_type, it doesn't
> notice that this is typedeffed to size_t, and therefore it doesn't
> suggest "%zu", but rather "%u" or "%lu".
>
> The attached patch makes the printf/scanf fix-up mechanism walk the
> typedef chain, so that it notices if the type is size_t, even if that
> isn't "at the top".
>
> Please take a look.
>
> Thanks,
> Hans
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120727/2ce478d2/attachment.html>


More information about the cfe-commits mailing list