1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 void 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 
8 void *alloca(__SIZE_TYPE__); // redeclaration okay
9 
10 int *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 
14 void g(int malloc) { // okay: these aren't functions
15   int calloc = 1;
16 }
17 
18 void 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 
24 void 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
30 void __builtin_object_size(); // expected-error{{conflicting types}} \
31 // expected-note{{'__builtin_object_size' is a builtin with type}}
32 
33 int a[10];
34 
35 int f0() {
36   return __builtin_object_size(&a); // expected-error {{too few arguments to function}}
37 }
38 
39 void * 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
45 void snprintf(); // expected-warning{{incompatible redeclaration of library function 'snprintf'}} \
46     // expected-note{{'snprintf' is a builtin}}
47 
48 int
49 main(int argc, char *argv[])
50 {
51   snprintf();
52 }
53 
54 void snprintf() { }
55 
56 // PR8316
57 void longjmp(); // expected-warning{{declaration of built-in function 'longjmp' requires inclusion of the header <setjmp.h>}}
58 
59 extern float fmaxf(float, float);
60