[cfe-commits] r148859 - in /cfe/trunk: lib/Analysis/FormatString.cpp lib/Analysis/PrintfFormatString.cpp lib/Analysis/ScanfFormatString.cpp test/Sema/format-strings-scanf.c test/Sema/format-strings.c

Chandler Carruth chandlerc at google.com
Tue Jan 24 15:43:53 PST 2012

If you would like to contribute a -Wformat-gnu set of warnings which flag
use of format specifiers that are GNU extensions, I think that would be a
very useful warning for Clang to have.

On Tue, Jan 24, 2012 at 3:15 PM, Joerg Sonnenberger <joerg at britannica.bec.de
> wrote:

> The problem is that it is about shutting up warnings for Linux (or OSX)
> specific code and at the same time stopping the warning for everyone
> else on code that needs them.

We can't have it both ways though. We have to pick one behavior to be the
default, and currently the largest users of Clang are on OSX or Linux and
thus benefit from the default behavior you are observing. It's not a great
way to choose a default, but neither is making warn by default for the
majority of its users on code that is correct. =/ Again, I'm not really
thrilled about it, but it seems pragmatic. It is at least consistent with
-Wgnu and other extensions in Clang.

I don't think its too onerous to have to pass -Wformat-gnu to get more
detailed warnings, any more than some folks pass -Wgnu to find out about
language extensions in use.

While it might be possible to make -Wformat include -Wformat-gnu when not
compiling in one af the '-std=gnu*' language dialect variations, that would
seem a really confusing bit of behavior. I like warning flags being simple
set arithmetic.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120124/a3f121dd/attachment.html>

More information about the cfe-commits mailing list