xref: /minix3/external/bsd/llvm/dist/clang/test/PCH/functions.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // Test this without pch.
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -include %S/functions.h -fsyntax-only -verify %s
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc // Test with pch.
5*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-pch -o %t %S/functions.h
6*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
7*f4a2713aSLionel Sambuc 
f0(int x0,int y0,...)8*f4a2713aSLionel Sambuc int f0(int x0, int y0, ...) { return x0 + y0; }
9*f4a2713aSLionel Sambuc 
test_f1(int val,double x,double y)10*f4a2713aSLionel Sambuc float *test_f1(int val, double x, double y) {
11*f4a2713aSLionel Sambuc   if (val > 5)
12*f4a2713aSLionel Sambuc     return f1(x, y);
13*f4a2713aSLionel Sambuc   else
14*f4a2713aSLionel Sambuc     return f1(x); // expected-error{{too few arguments to function call}}
15*f4a2713aSLionel Sambuc                   // expected-note@functions.h:7{{'f1' declared here}}
16*f4a2713aSLionel Sambuc }
17*f4a2713aSLionel Sambuc 
test_g0(int * x,float * y)18*f4a2713aSLionel Sambuc void test_g0(int *x, float * y) {
19*f4a2713aSLionel Sambuc   g0(y); // expected-warning{{incompatible pointer types passing 'float *' to parameter of type 'int *'}}
20*f4a2713aSLionel Sambuc          // expected-note@functions.h:9{{passing argument to parameter here}}
21*f4a2713aSLionel Sambuc   g0(x);
22*f4a2713aSLionel Sambuc }
23*f4a2713aSLionel Sambuc 
test_abort(int code)24*f4a2713aSLionel Sambuc void __attribute__((noreturn)) test_abort(int code) {
25*f4a2713aSLionel Sambuc   do_abort(code);
26*f4a2713aSLionel Sambuc }
27*f4a2713aSLionel Sambuc 
28