diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-03-23 17:47:24 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-03-23 17:47:24 +0000 |
commit | 893c2c963a5db7abddfa4b37e9d69f89131aafbd (patch) | |
tree | 8f822cb67b4359d5e9e9f54e2d1f52c172686c6b /clang/lib/Sema/SemaDecl.cpp | |
parent | f477262e69ce9ed268c45272c8c2f0fdd59713fe (diff) | |
download | bcm5719-llvm-893c2c963a5db7abddfa4b37e9d69f89131aafbd.tar.gz bcm5719-llvm-893c2c963a5db7abddfa4b37e9d69f89131aafbd.zip |
Fix PR3855. When we encounter an incompatible redeclaration of a
library function, accept this declaration and pretend that we do not
know that this is a library function. autoconf depends on this
(broken) behavior.
llvm-svn: 67541
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 89375d7066e..bcb21c33ce9 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -747,11 +747,14 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { if (Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID)) { // The function the user is redeclaring is a library-defined // function like 'malloc' or 'printf'. Warn about the - // redeclaration, then ignore it. + // redeclaration, then pretend that we don't know about this + // library built-in. Diag(New->getLocation(), diag::warn_redecl_library_builtin) << New; Diag(Old->getLocation(), diag::note_previous_builtin_declaration) << Old << Old->getType(); - return true; + New->getIdentifier()->setBuiltinID(Builtin::NotBuiltin); + Old->setInvalidDecl(); + return false; } PrevDiag = diag::note_previous_builtin_declaration; |