1 // RUN: %clang_cc1 -fsyntax-only -Wno-strict-prototypes -verify %s
4 int *ptr
= malloc(sizeof(int) * 10); // expected-error{{call to undeclared library function 'malloc' with type}} \
5 // expected-note{{include the header <stdlib.h> or explicitly provide a declaration for 'malloc'}} \
6 // expected-note{{'malloc' is a builtin with type 'void *}}
9 void *alloca(__SIZE_TYPE__
); // redeclaration okay
11 int *calloc(__SIZE_TYPE__
, __SIZE_TYPE__
); // expected-warning{{incompatible redeclaration of library function 'calloc'}} \
12 // expected-note{{'calloc' is a builtin with type 'void *}}
15 void g(int malloc
) { // okay: these aren't functions
20 int malloc(int); // expected-warning{{incompatible redeclaration of library function 'malloc'}}
21 int strcpy(int); // expected-warning{{incompatible redeclaration of library function 'strcpy'}} \
22 // expected-note{{'strcpy' is a builtin with type 'char *(char *, const char *)'}}
26 fprintf(0, "foo"); // expected-warning{{declaration of built-in function 'fprintf' requires inclusion of the header <stdio.h>}} \
27 expected
-error
{{call to undeclared function
'fprintf'; ISO C99
and later
do not support implicit function declarations
}}
31 void __builtin_object_size(); // expected-error{{conflicting types}} \
32 // expected-note{{'__builtin_object_size' is a builtin with type}}
37 return __builtin_object_size(&a
); // expected-error {{too few arguments to function}}
40 void * realloc(void *p
, int size
) { // expected-warning{{incompatible redeclaration of library function 'realloc'}} \
41 // expected-note{{'realloc' is a builtin with type 'void *(void *,}}
46 void snprintf(); // expected-warning{{incompatible redeclaration of library function 'snprintf'}} \
47 // expected-note{{'snprintf' is a builtin}}
50 main(int argc
, char *argv
[])
59 extern float fmaxf(float, float);
61 struct __jmp_buf_tag
{};
62 void sigsetjmp(struct __jmp_buf_tag
[1], int);
65 void pthread_create(); // no warning expected