[cfe-commits] [Patch] Warn about non-standard format strings (PR12017)

Hans Wennborg hans at chromium.org
Wed Feb 22 02:43:06 PST 2012


On Tue, Feb 21, 2012 at 20:15, Ted Kremenek <kremenek at apple.com> wrote:
> On Feb 21, 2012, at 3:39 AM, Hans Wennborg <hans at chromium.org> wrote:
>
> On Mon, Feb 20, 2012 at 19:37, Ted Kremenek <kremenek at apple.com> wrote:
>
> On Feb 20, 2012, at 11:25 AM, Hans Wennborg <hans at chromium.org> wrote:
>
> Keeping -Wformat-nonstandard out of -Wformat and having it in
> -pedantic sounds perfectly fine to me. I expect that lines up with
> what gcc does too.
>
>
> Ok, I think that approach is worth experimenting with.
>
>
> Cool. I think getting this warning in under -pedantic is a good step
> in the right direction.
>
>
> Me too.
>
>
> I've looked at the patch, and other than the default configuration of the
> warnings, it looks okay to me.
>
>
> I've updated the patch to make the warning DefaultIgnore and ExtWarn.
>
> I've also changed it to not make a difference between -std=c99 and
> -std=gnu99. If the user specifies -pedantic, I think we should warn
> for '%ms' even if the user has selected -std=gnu99. This matches gcc
> behavior too, and it's extra important because if the user doesn't
> specify the -std flag, then gnu99 seems the be the default c mode.
>
>
> Sounds great.
>
>
> One nit on wording in the diagnostic: "non-standard" or "non-portable"?  The
> former is more technically accurate, but the latter is the implication the
> user cares about.  What do you think?
>
>
> I'd prefer "non-standard", but I don't feel strongly about it.
>
>
> I don't either.  I'm fine with staying with non-standard.
>
>
> I noticed that this sparks new failures in
> "clang-tests/gcc-4_2-testsuite" (excess warning), so I'm attaching a
> patch for that too. Please take a look.
>
>
> I did.  The change looks reasonable.
>
>
> Please commit!
>

Committed r151153 and r151154.

Thanks,
Hans




More information about the cfe-commits mailing list