Don't special case one line extern "C" decls.

We already avoided warning for

extern "C" const char *Version_string = "2.9";

now we also don't produce any warnings for

extern "C" {
  extern const char *Version_string2 = "2.9";
}

llvm-svn: 178333
This commit is contained in:
Rafael Espindola 2013-03-29 07:02:31 +00:00
parent 67ce1472b4
commit 980c053cb9
2 changed files with 5 additions and 0 deletions

View File

@ -7565,6 +7565,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init,
}
} else if (VDecl->isFileVarDecl()) {
if (VDecl->getStorageClassAsWritten() == SC_Extern &&
!VDecl->isExternC() &&
(!getLangOpts().CPlusPlus ||
!Context.getBaseElementType(VDecl->getType()).isConstQualified()))
Diag(VDecl->getLocation(), diag::warn_extern_init);

View File

@ -90,6 +90,10 @@ extern "C++" using N::value;
// PR7076
extern "C" const char *Version_string = "2.9";
extern "C" {
extern const char *Version_string2 = "2.9";
}
namespace PR9162 {
extern "C" {
typedef struct _ArtsSink ArtsSink;