From: Douglas Gregor Date: Wed, 18 Feb 2009 22:00:45 +0000 (+0000) Subject: Return true on errors, return true on errors, return true on errors X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c2b6a8239326456753cd7d636656e420feaecb40;p=clang Return true on errors, return true on errors, return true on errors git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64957 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index a276f3c1ce..9cd5bc8069 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -660,7 +660,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { Diag(New->getLocation(), diag::warn_redecl_library_builtin) << New; Diag(Old->getLocation(), diag::note_previous_builtin_declaration) << Old << Old->getType(); - return false; + return true; } PrevDiag = diag::note_previous_builtin_declaration; diff --git a/test/Sema/implicit-builtin-redecl.c b/test/Sema/implicit-builtin-redecl.c index 837f79f4ef..9ff23f9f13 100644 --- a/test/Sema/implicit-builtin-redecl.c +++ b/test/Sema/implicit-builtin-redecl.c @@ -5,3 +5,10 @@ static void* malloc(int); static void* malloc(int size) { return ((void*)0); /*do not use heap in this file*/ } + +void *calloc(int, int, int); // expected-warning{{incompatible redeclaration of library function 'calloc' will be ignored}} \ +// expected-note{{'calloc' is a builtin with type 'void *(unsigned long, unsigned long)'}} + +void f1(void) { + return calloc(0, 0, 0); // expected-error{{too many arguments to function call}} +}