[cfe-commits] r146326 - in /cfe/trunk: include/clang/Analysis/Analyses/FormatString.h lib/Analysis/ScanfFormatString.cpp lib/Sema/SemaChecking.cpp test/Analysis/taint-generic.c test/Analysis/taint-tester.c test/Sema/format-strings-fixit.c test/Se
hans at chromium.org
Mon Jan 9 03:11:20 PST 2012
On Tue, Jan 3, 2012 at 7:24 PM, Joerg Sonnenberger
<joerg at britannica.bec.de> wrote:
> On Tue, Dec 13, 2011 at 12:13:40PM +0000, Hans Wennborg wrote:
>> On Tue, Dec 13, 2011 at 6:47 AM, Ted Kremenek <kremenek at apple.com> wrote:
>> > It is also possible that those tests need to be modified if Clang's behavior
>> > ends up being more desirable than what is reflected in those tests. I
>> > haven't looked at them, so I don't know off hand.
>> The failing tests use the 'a' length modifier, a GNU extension
>> available for C90 which can be used with strings and scanlists, that I
>> didn't know about before.
> I've just run into yet another case where a GNU extension leaked into
> the default format string parsing. %m is allowed by default,
> even though this seems to be a glibc-only extension.
I didn't think Clang currently parsed the 'm' length modifier? It's on
my to-do list, but I haven't done it yet.
> Which brings up the
> question, why this extensions are even allowed by default with
> -std=gnu99 or -std=gnu90. They are not only GNU compiler extensions,
> more importantly, they are libc extensions and somewhat dangerous to use
> in portable code. Can we please move them under a separate option? For
> Linux, the option could be disabled by default...
I've been meaning to make -pedantic warn about the 'a' and 'm' length
modifiers (unless when std=gnu90 or std=gnu99 respectively, I suppose)
to match GCC's behavior. But maybe we should just have
-Wformat-gnu-extensions that you mentioned below be on by default?
More information about the cfe-commits