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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67541 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/implicit-builtin-decl.c b/test/Sema/implicit-builtin-decl.c
index e1f24e3..6477a57 100644
--- a/test/Sema/implicit-builtin-decl.c
+++ b/test/Sema/implicit-builtin-decl.c
@@ -7,7 +7,7 @@
void *alloca(__SIZE_TYPE__); // redeclaration okay
-int *calloc(__SIZE_TYPE__, __SIZE_TYPE__); // expected-warning{{incompatible redeclaration of library function 'calloc' will be ignored}} \
+int *calloc(__SIZE_TYPE__, __SIZE_TYPE__); // expected-warning{{incompatible redeclaration of library function 'calloc'}} \
// expected-note{{'calloc' is a builtin with type 'void *}}
@@ -16,8 +16,8 @@
}
void h() {
- int malloc(int); // expected-warning{{incompatible redeclaration of library function 'malloc' will be ignored}}
- int strcpy(int); // expected-warning{{incompatible redeclaration of library function 'strcpy' will be ignored}} \
+ int malloc(int); // expected-warning{{incompatible redeclaration of library function 'malloc'}}
+ int strcpy(int); // expected-warning{{incompatible redeclaration of library function 'strcpy'}} \
// expected-note{{'strcpy' is a builtin with type 'char *(char *, char const *)'}}
}
@@ -35,7 +35,19 @@
return __builtin_object_size(&a); // expected-error {{too few arguments to function}}
}
-void * realloc(void *p, int size) { // expected-warning{{incompatible redeclaration of library function 'realloc' will be ignored}} \
+void * realloc(void *p, int size) { // expected-warning{{incompatible redeclaration of library function 'realloc'}} \
// expected-note{{'realloc' is a builtin with type 'void *(void *,}}
return p;
}
+
+// PR3855
+void snprintf(); // expected-warning{{incompatible redeclaration of library function 'snprintf'}} \
+ // expected-note{{'snprintf' is a builtin with type 'int (char *, unsigned long, char const *, ...)'}}
+
+int
+main(int argc, char *argv[])
+{
+ snprintf();
+}
+
+void snprintf() { }