xref: /llvm-project/clang/test/PCH/functions.c (revision fcc699aee8db46ecbe6d334afde59140dcb7e3af)
192f056faSDouglas Gregor // Test this without pch.
28fbe78f6SDaniel Dunbar // RUN: %clang_cc1 -include %S/functions.h -fsyntax-only -verify %s
392f056faSDouglas Gregor 
492f056faSDouglas Gregor // Test with pch.
58fbe78f6SDaniel Dunbar // RUN: %clang_cc1 -emit-pch -o %t %S/functions.h
68fbe78f6SDaniel Dunbar // RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
7*fcc699aeSAndy Gibbs 
f0(int x0,int y0,...)892f056faSDouglas Gregor int f0(int x0, int y0, ...) { return x0 + y0; }
9*fcc699aeSAndy Gibbs 
test_f1(int val,double x,double y)1092f056faSDouglas Gregor float *test_f1(int val, double x, double y) {
1192f056faSDouglas Gregor   if (val > 5)
1292f056faSDouglas Gregor     return f1(x, y);
1392f056faSDouglas Gregor   else
1492f056faSDouglas Gregor     return f1(x); // expected-error{{too few arguments to function call}}
15*fcc699aeSAndy Gibbs                   // expected-note@functions.h:7{{'f1' declared here}}
1692f056faSDouglas Gregor }
1792f056faSDouglas Gregor 
test_g0(int * x,float * y)1892f056faSDouglas Gregor void test_g0(int *x, float * y) {
19c68e1406SDouglas Gregor   g0(y); // expected-warning{{incompatible pointer types passing 'float *' to parameter of type 'int *'}}
20*fcc699aeSAndy Gibbs          // expected-note@functions.h:9{{passing argument to parameter here}}
2192f056faSDouglas Gregor   g0(x);
2292f056faSDouglas Gregor }
23dc72875dSDouglas Gregor 
test_abort(int code)24dc72875dSDouglas Gregor void __attribute__((noreturn)) test_abort(int code) {
25dc72875dSDouglas Gregor   do_abort(code);
26dc72875dSDouglas Gregor }
27dc72875dSDouglas Gregor 
28