public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Updated GCC vs Clang diagnostics [Was: Switching to C++ by default in 4.8]
@ 2012-04-12 10:02 Jonathan Wakely
  2012-04-12 10:07 ` Pedro Alves
  2012-04-12 10:35 ` Richard Guenther
  0 siblings, 2 replies; 14+ messages in thread
From: Jonathan Wakely @ 2012-04-12 10:02 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Xinliang David Li, gcc

On 11 April 2012 19:41, Pedro Alves wrote:
> On 04/11/2012 07:26 PM, Jonathan Wakely wrote:
>
>> GCC's diagnostics have got a lot better recently.
>>
>> The http://clang.llvm.org/diagnostics.html page compares clang's
>> diagnostics to GCC 4.2, which was outdated long before that page was
>> written.
>>
>> It doesn't help GCC's cause when people keep repeating that outdated info :-)
>
>
> Spelling out the obvious, IWBVN if someone from the gcc camp did a
> similar comparison using a current gcc.  Is there such a page somewhere?

Manu has filed lots of bugs in bugzilla with specific comparisons of
GCC's diagnostics to Clang's.

I'll start a page on the GCC wiki but I hope others will add to it.
The people asking to see results should be the ones doing the
comparisons really  ;-)

For now, the first example on the clang page now shows GCC is better,
because it warns about *both* missing arguments, while Clang only gets
one (even in the unreleased 3.1 version from svn)

$ gcc-4.7 -fsyntax-only  -Wformat format-strings.c
format-strings.c: In function 'f':
format-strings.c:4:5: warning: field precision specifier '.*' expects
a matching 'int' argument [-Wformat]
format-strings.c:4:5: warning: format '%d' expects a matching 'int'
argument [-Wformat]

$ clang-3.1 -fsyntax-only format-strings.c
format-strings.c:4:15: warning: '.*' specified field precision is
missing a matching 'int' argument
    printf("%.*d");
            ~~^~
1 warning generated.

Using this source:


#include <stdio.h>

void f() {
    printf("%.*d");
}


And the last example on the page now gives:

$ g++-4.7 tsc.cc
tsc.cc:2:10: error: expected ';' after class definition
tsc.cc:6:1: error: expected ';' after struct definition
$ clang++-3.1 tsc.cc
tsc.cc:2:11: error: expected ';' after class
class a {}
          ^
          ;
tsc.cc:6:2: error: expected ';' after struct
}
 ^
 ;
2 errors generated.

Which was using this source:

template<class T>
class a {}
class temp {};
a<temp> b;
struct b {
}

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-04-13 19:36 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-12 10:02 Updated GCC vs Clang diagnostics [Was: Switching to C++ by default in 4.8] Jonathan Wakely
2012-04-12 10:07 ` Pedro Alves
2012-04-12 10:35 ` Richard Guenther
2012-04-12 10:41   ` Jonathan Wakely
2012-04-12 19:43     ` Jonathan Wakely
2012-04-12 19:47       ` Gabriel Dos Reis
2012-04-12 21:32       ` Xinliang David Li
2012-04-12 21:51         ` Jonathan Wakely
2012-04-12 21:53           ` Xinliang David Li
2012-04-12 22:29             ` Jonathan Wakely
2012-04-12 22:33               ` Xinliang David Li
2012-04-13 14:12   ` Ludovic Courtès
2012-04-13 15:30     ` Gabriel Dos Reis
2012-04-13 19:36       ` Oleg Endo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).