[cfe-commits] [Patch] Format string warnings should refer to "%zu" etc by typedef type

Matt Beaumont-Gay matthewbg at google.com
Fri Dec 2 09:24:11 PST 2011


On Thu, Dec 1, 2011 at 06:39, Hans Wennborg <hans at chromium.org> wrote:
> Hi all,
>
> The attached patch changes the warning for
>
> printf("%zu", 42.0);
>
> from "conversion specifies type 'unsigned long'" to "conversion
> specifies type 'size_t' (aka 'unsigned long')" if the relevant typedef
> is in scope.
>
> Please take a look and let me know if it's ok for me to land.

+/// \brief Try to find and return a typedef type with name |Name| and
underlying
+/// type |Underlying|. Return |Underlying| if one cannot be found.

The | notation is a little surprising; I don't recall seeing it
anywhere else in Clang doxyments. Maybe just:

/// Try to find and return a typedef type named Name whose actual type
is Underlying.

That is, I think the leading caps are enough to make it clear that
you're referring to the parameters there.

+++ b/test/Sema/format-strings-int-typedefs.c
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s

Is the triple necessary here?

-Matt



More information about the cfe-commits mailing list