]> granicus.if.org Git - clang/commitdiff
Return true on errors, return true on errors, return true on errors
authorDouglas Gregor <dgregor@apple.com>
Wed, 18 Feb 2009 22:00:45 +0000 (22:00 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 18 Feb 2009 22:00:45 +0000 (22:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64957 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/Sema/implicit-builtin-redecl.c

index a276f3c1cee1e9dee9b677b9adcb6e12efa1671e..9cd5bc8069456e599f6d50bdda5bdc7d0c725a19 100644 (file)
@@ -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;
index 837f79f4ef6120582d66b4360f6248633bcbaac6..9ff23f9f13b4d5a8bcd37c4245ed39267f63fb9a 100644 (file)
@@ -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}}
+}