diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-27 01:46:12 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-27 01:46:12 +0000 |
commit | d0359af5113c1936ff3f699c7d700adff59351f2 (patch) | |
tree | 0b91cd119c58640b0e70f2fa84a465dd0f595163 /lib/Sema/SemaDecl.cpp | |
parent | 8849e64ad4255278ccaa17443d88f117cde89933 (diff) |
Change our silencing of C typedef redefinition handling to what we had
before r69391: typedef redefinition is an error by default, but if
*either* the old or new definition are from a system header, we silence
it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70177 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 1ea3a9ec3c..482c304603 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -560,7 +560,12 @@ void Sema::MergeTypeDefDecl(TypedefDecl *New, Decl *OldD) { // If we have a redefinition of a typedef in C, emit a warning. This warning // is normally mapped to an error, but can be controlled with - // -Wtypedef-redefinition. + // -Wtypedef-redefinition. If either the original was in a system header, + // don't emit this for compatibility with GCC. + if (PP.getDiagnostics().getSuppressSystemWarnings() && + Context.getSourceManager().isInSystemHeader(Old->getLocation())) + return; + Diag(New->getLocation(), diag::warn_redefinition_of_typedef) << New->getDeclName(); Diag(Old->getLocation(), diag::note_previous_definition); |