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

Hans Wennborg hans at chromium.org
Mon Feb 20 10:31:53 PST 2012


Hi all,

Attached is a first stab at adding a warning for using non-standard
things in format strings (like the 'q' length modifier or the 'S'
conversion specifier).

I'm a little bit confused about the status of some of these. For
example, should 'C' and 'S' be considered GNU extensions, and
therefore allowable when using -std=gnu99?

Also, there might be a better approach to this, or better names for
things, etc. so please take a look.

This causes a bunch of new failures in the gcc.dg test-suite. For
instance, in gcc.dg/format/c90-scanf-3.c it will warn about the 'a'
length modifier. The test says "Formats using extensions to the
standard should be rejected in strict pedantic mode." so I think my
patch is doing the right thing, but maybe the expectations need to be
tweaked a bit.

Thanks,
Hans
-------------- next part --------------
A non-text attachment was scrubbed...
Name: non-standard-format-strings.diff
Type: application/octet-stream
Size: 16958 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120220/78001dc4/attachment.obj>


More information about the cfe-commits mailing list