1// RUN: %clang_cc1 -fsyntax-only -verify %s
2void f() {
3  int *ptr = malloc(sizeof(int) * 10); // expected-warning{{implicitly declaring library function 'malloc' with type}} \
4  // expected-note{{please include the header <stdlib.h> or explicitly provide a declaration for 'malloc'}} \
5  // expected-note{{'malloc' is a builtin with type 'void *}}
6}
7
8void *alloca(__SIZE_TYPE__); // redeclaration okay
9
10int *calloc(__SIZE_TYPE__, __SIZE_TYPE__); // expected-warning{{incompatible redeclaration of library function 'calloc'}} \
11                    // expected-note{{'calloc' is a builtin with type 'void *}}
12
13
14void g(int malloc) { // okay: these aren't functions
15  int calloc = 1;
16}
17
18void h() {
19  int malloc(int); // expected-warning{{incompatible redeclaration of library function 'malloc'}}
20  int strcpy(int); // expected-warning{{incompatible redeclaration of library function 'strcpy'}} \
21  // expected-note{{'strcpy' is a builtin with type 'char *(char *, const char *)'}}
22}
23
24void f2() {
25  fprintf(0, "foo"); // expected-warning{{declaration of built-in function 'fprintf' requires inclusion of the header <stdio.h>}} \
26   expected-warning {{implicit declaration of function 'fprintf' is invalid in C99}}
27}
28
29// PR2892
30void __builtin_object_size(); // expected-error{{conflicting types}} \
31// expected-note{{'__builtin_object_size' is a builtin with type}}
32
33int a[10];
34
35int f0() {
36  return __builtin_object_size(&a); // expected-error {{too few arguments to function}}
37}
38
39void * realloc(void *p, int size) { // expected-warning{{incompatible redeclaration of library function 'realloc'}} \
40// expected-note{{'realloc' is a builtin with type 'void *(void *,}}
41  return p;
42}
43
44// PR3855
45void snprintf(); // expected-warning{{incompatible redeclaration of library function 'snprintf'}} \
46    // expected-note{{'snprintf' is a builtin}}
47
48int
49main(int argc, char *argv[])
50{
51  snprintf();
52}
53
54void snprintf() { }
55
56// PR8316
57void longjmp(); // expected-warning{{declaration of built-in function 'longjmp' requires inclusion of the header <setjmp.h>}}
58
59extern float fmaxf(float, float);
60