summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-04-19 22:34:40 +0000
committerDouglas Gregor <dgregor@apple.com>2010-04-19 22:34:40 +0000
commitf4cd8f4ece29e28e0d503b105432b5b4a1dc4519 (patch)
tree90e49edf2d6462f86e76680c5a790d1bb75369e0 /clang/lib/Sema/SemaDecl.cpp
parente637ff5e9a884299418c4da192ab88b2d2197f28 (diff)
downloadbcm5719-llvm-f4cd8f4ece29e28e0d503b105432b5b4a1dc4519.tar.gz
bcm5719-llvm-f4cd8f4ece29e28e0d503b105432b5b4a1dc4519.zip
Only suppress the "extern variable has an initializer" warning when the extern entity being initialized is const.
llvm-svn: 101821
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 045b3e8c381..115b7bf756e 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -3819,7 +3819,7 @@ void Sema::AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit) {
}
} else if (VDecl->isFileVarDecl()) {
if (VDecl->getStorageClass() == VarDecl::Extern &&
- !getLangOptions().CPlusPlus)
+ (!getLangOptions().CPlusPlus || !VDecl->getType().isConstQualified()))
Diag(VDecl->getLocation(), diag::warn_extern_init);
if (!VDecl->isInvalidDecl()) {
InitializationSequence InitSeq(*this, Entity, Kind, &Init, 1);
OpenPOWER on IntegriCloud