[cfe-commits] [Patch] suggest %zu for size_t args to printf (PR11152)

Peter Collingbourne peter at pcc.me.uk
Mon Oct 17 11:18:48 PDT 2011


On Mon, Oct 17, 2011 at 10:59:50AM +0200, Hans Wennborg wrote:
> Hi all,
> 
> The attached patch is for PR11152.
> 
> It makes PrintfSpecifier::fixType() choose "%zu" for size_t, etc.,
> rather than looking at the underlying type and suggesting "%llu" or
> other platform-specific length modifiers. This is for C99, C1X and
> C++11.
> 
> Please let me know if this is ok to land.

> +      (LangOpt.C99 || LangOpt.C1X || LangOpt.CPlusPlus0x)) {

C1X implies C99, so you don't need to test for it separately here.
Other than that, LGTM.

Thanks,
-- 
Peter



More information about the cfe-commits mailing list