This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Updated GCC vs Clang diagnostics [Was: Switching to C++ by default in 4.8]

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 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
1 warning generated.

Using this source:

#include <stdio.h>

void f() {

And the last example on the page now gives:

$ g++-4.7 error: expected ';' after class definition error: expected ';' after struct definition
$ clang++-3.1 error: expected ';' after class
class a {}
          ; error: expected ';' after struct
2 errors generated.

Which was using this source:

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]