summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-27 01:46:12 +0000
committerChris Lattner <sabre@nondot.org>2009-04-27 01:46:12 +0000
commit9a845896712365f3f1371eb28a7ea1d7e773d09c (patch)
treea1d8e27a318825fe05d5968db4e062503d727533 /clang/lib/Sema/SemaDecl.cpp
parent05c1d372b770f812930915663e4fd8e315234808 (diff)
downloadbcm5719-llvm-9a845896712365f3f1371eb28a7ea1d7e773d09c.tar.gz
bcm5719-llvm-9a845896712365f3f1371eb28a7ea1d7e773d09c.zip
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. llvm-svn: 70177
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 1ea3a9ec3c7..482c304603b 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud