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

Ted Kremenek kremenek at apple.com
Tue Feb 21 12:15:47 PST 2012


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!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120221/05c43d2f/attachment.html>


More information about the cfe-commits mailing list