13a2f7e42514ddbec983c61826ce85d3071e23e8eDouglas Gregor// Test this without pch.
2a5728872c7702ddd09537c95bc3cbd20e1f2fb09Daniel Dunbar// RUN: %clang_cc1 -include %S/functions.h -fsyntax-only -verify %s
33a2f7e42514ddbec983c61826ce85d3071e23e8eDouglas Gregor
43a2f7e42514ddbec983c61826ce85d3071e23e8eDouglas Gregor// Test with pch.
5a5728872c7702ddd09537c95bc3cbd20e1f2fb09Daniel Dunbar// RUN: %clang_cc1 -emit-pch -o %t %S/functions.h
6a5728872c7702ddd09537c95bc3cbd20e1f2fb09Daniel Dunbar// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
7b42f200777a66b98989160bf3987ce431540a584Andy Gibbs
83a2f7e42514ddbec983c61826ce85d3071e23e8eDouglas Gregorint f0(int x0, int y0, ...) { return x0 + y0; }
9b42f200777a66b98989160bf3987ce431540a584Andy Gibbs
103a2f7e42514ddbec983c61826ce85d3071e23e8eDouglas Gregorfloat *test_f1(int val, double x, double y) {
113a2f7e42514ddbec983c61826ce85d3071e23e8eDouglas Gregor  if (val > 5)
123a2f7e42514ddbec983c61826ce85d3071e23e8eDouglas Gregor    return f1(x, y);
133a2f7e42514ddbec983c61826ce85d3071e23e8eDouglas Gregor  else
143a2f7e42514ddbec983c61826ce85d3071e23e8eDouglas Gregor    return f1(x); // expected-error{{too few arguments to function call}}
15b42f200777a66b98989160bf3987ce431540a584Andy Gibbs                  // expected-note@functions.h:7{{'f1' declared here}}
163a2f7e42514ddbec983c61826ce85d3071e23e8eDouglas Gregor}
173a2f7e42514ddbec983c61826ce85d3071e23e8eDouglas Gregor
183a2f7e42514ddbec983c61826ce85d3071e23e8eDouglas Gregorvoid test_g0(int *x, float * y) {
19d4eea8362605807327735727a9098abe1eb23b19Douglas Gregor  g0(y); // expected-warning{{incompatible pointer types passing 'float *' to parameter of type 'int *'}}
20b42f200777a66b98989160bf3987ce431540a584Andy Gibbs         // expected-note@functions.h:9{{passing argument to parameter here}}
213a2f7e42514ddbec983c61826ce85d3071e23e8eDouglas Gregor  g0(x);
223a2f7e42514ddbec983c61826ce85d3071e23e8eDouglas Gregor}
239123666ed4ab82182b92f8d978a2801516dcd63dDouglas Gregor
249123666ed4ab82182b92f8d978a2801516dcd63dDouglas Gregorvoid __attribute__((noreturn)) test_abort(int code) {
259123666ed4ab82182b92f8d978a2801516dcd63dDouglas Gregor  do_abort(code);
269123666ed4ab82182b92f8d978a2801516dcd63dDouglas Gregor}
279123666ed4ab82182b92f8d978a2801516dcd63dDouglas Gregor
28