r178333 - Don't special case one line extern "C" decls.
Rafael Espindola
rafael.espindola at gmail.com
Fri Mar 29 00:02:32 PDT 2013
Author: rafael
Date: Fri Mar 29 02:02:31 2013
New Revision: 178333
URL: http://llvm.org/viewvc/llvm-project?rev=178333&view=rev
Log:
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";
}
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCXX/linkage-spec.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=178333&r1=178332&r2=178333&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Mar 29 02:02:31 2013
@@ -7565,6 +7565,7 @@ void Sema::AddInitializerToDecl(Decl *Re
}
} 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);
Modified: cfe/trunk/test/SemaCXX/linkage-spec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/linkage-spec.cpp?rev=178333&r1=178332&r2=178333&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/linkage-spec.cpp (original)
+++ cfe/trunk/test/SemaCXX/linkage-spec.cpp Fri Mar 29 02:02:31 2013
@@ -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;
More information about the cfe-commits
mailing list