aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-03-29 07:02:31 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-03-29 07:02:31 +0000
commitb6bead467640e4d05f6a0a90255eebc939f690a2 (patch)
tree8cb3c0d0dae84b058e73ab63e30d834c43aa4a67
parent1bfc28c48c1b86a05d2e07b403107ef3da5a0f8e (diff)
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"; } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178333 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaDecl.cpp1
-rw-r--r--test/SemaCXX/linkage-spec.cpp4
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index ab4a17a30d..1c6bbedf5e 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -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);
diff --git a/test/SemaCXX/linkage-spec.cpp b/test/SemaCXX/linkage-spec.cpp
index cb7e32c05d..0ba9508124 100644
--- a/test/SemaCXX/linkage-spec.cpp
+++ b/test/SemaCXX/linkage-spec.cpp
@@ -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;