[LLVMbugs] [Bug 3983] Improve handling of variables with different storage spec

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 21 14:31:50 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=3983

Kaelyn Uhrain <rikka at google.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |rikka at google.com
         Resolution|                            |FIXED

--- Comment #1 from Kaelyn Uhrain <rikka at google.com> 2012-06-21 16:31:50 CDT ---
With the 3.1 release, clang provides quite nice diagnostics (and much better
than gcc 4.7's "error: redeclaration of..." messages):

$ cat tmp.cc 
void f0() {
  // FIXME: Diagnose this?
  int g6;
  extern int g6;
}

void f1() {
  // FIXME: Diagnose this?
  int g7;
  __private_extern__ int g7;
}

void f2() {
  extern int g8; // expected-note{{previous definition}}
  // FIXME: Improve this diagnostic.
  int g8; // expected-error{{redefinition of 'g8'}}
}

void f3() {
  __private_extern__ int g9; // expected-note{{previous definition}}
  // FIXME: Improve this diagnostic.
  int g9; // expected-error{{redefinition of 'g9'}}
}

$ clang -fsyntax-only tmp.cc 
tmp.cc:4:14: error: extern declaration of 'g6' follows non-extern declaration
  extern int g6;
             ^
tmp.cc:3:7: note: previous definition is here
  int g6;
      ^
tmp.cc:10:26: error: extern declaration of 'g7' follows non-extern declaration
  __private_extern__ int g7;
                         ^
tmp.cc:9:7: note: previous definition is here
  int g7;
      ^
tmp.cc:16:7: error: non-extern declaration of 'g8' follows extern declaration
  int g8; // expected-error{{redefinition of 'g8'}}
      ^
tmp.cc:14:14: note: previous definition is here
  extern int g8; // expected-note{{previous definition}}
             ^
tmp.cc:22:7: error: non-extern declaration of 'g9' follows extern declaration
  int g9; // expected-error{{redefinition of 'g9'}}
      ^
tmp.cc:20:26: note: previous definition is here
  __private_extern__ int g9; // expected-note{{previous definition}}
                         ^
4 errors generated.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list