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 | 379246d29b1c7ef2659beadf41b4cb79806c0e63 (patch) | |
tree | b9754474f0d84c0e89a3e63db1965f5207c6ce8b /lib/Sema/SemaDecl.cpp | |
parent | 7da19ea50d4161fcda40d135735bcf450cabeb50 (diff) |
Don't warn about the 'extern' in 'extern "C"' on a tag decl. This is
usually useless, but not always.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128326 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 5a4df400f3..59b4f5f229 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/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()) { |