diff options
author | John McCall <rjmccall@apple.com> | 2011-03-26 02:09:52 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-03-26 02:09:52 +0000 |
commit | 4d55f5a89362e568605f4bbb21814ee4becdb09c (patch) | |
tree | cada01619c2701279b5d07cc6248a331484d5d3f /clang/lib | |
parent | 405988b97c0e8916dfedbca507f30eb8ede83112 (diff) | |
download | bcm5719-llvm-4d55f5a89362e568605f4bbb21814ee4becdb09c.tar.gz bcm5719-llvm-4d55f5a89362e568605f4bbb21814ee4becdb09c.zip |
Don't warn about the 'extern' in 'extern "C"' on a tag decl. This is
usually useless, but not always.
llvm-svn: 128326
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 5a4df400f3b..59b4f5f2292 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -1870,9 +1870,14 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, if (emittedWarning || (TagD && TagD->isInvalidDecl())) return TagD; + // Note that a linkage-specification sets a storage class, but + // 'extern "C" struct foo;' is actually valid and not theoretically + // useless. if (DeclSpec::SCS scs = DS.getStorageClassSpec()) - Diag(DS.getStorageClassSpecLoc(), diag::warn_standalone_specifier) - << DeclSpec::getSpecifierName(scs); + if (!DS.isExternInLinkageSpec()) + Diag(DS.getStorageClassSpecLoc(), diag::warn_standalone_specifier) + << DeclSpec::getSpecifierName(scs); + if (DS.isThreadSpecified()) Diag(DS.getThreadSpecLoc(), diag::warn_standalone_specifier) << "__thread"; if (DS.getTypeQualifiers()) { |