xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/implicit-builtin-redecl.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc // PR3592
4*f4a2713aSLionel Sambuc static void* malloc(int);
malloc(int size)5*f4a2713aSLionel Sambuc static void* malloc(int size) {
6*f4a2713aSLionel Sambuc   return ((void*)0); /*do not use heap in this file*/
7*f4a2713aSLionel Sambuc }
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc void *calloc(int, int, int); // expected-warning{{incompatible redeclaration of library function 'calloc'}} \
10*f4a2713aSLionel Sambuc // expected-note{{'calloc' is a builtin with type 'void *}}
11*f4a2713aSLionel Sambuc 
f1(void)12*f4a2713aSLionel Sambuc void f1(void) {
13*f4a2713aSLionel Sambuc   calloc(0, 0, 0);
14*f4a2713aSLionel Sambuc }
15*f4a2713aSLionel Sambuc 
f2()16*f4a2713aSLionel Sambuc void f2() {
17*f4a2713aSLionel Sambuc   int index = 1;
18*f4a2713aSLionel Sambuc }
19*f4a2713aSLionel Sambuc 
20*f4a2713aSLionel Sambuc static int index;
21*f4a2713aSLionel Sambuc 
f3()22*f4a2713aSLionel Sambuc int f3() {
23*f4a2713aSLionel Sambuc   return index << 2;
24*f4a2713aSLionel Sambuc }
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc typedef int rindex;
27