Douglas Gregor | 3a2f7e4 | 2009-04-13 22:18:37 +0000 | [diff] [blame] | 1 | // Test this without pch. |
Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -include %S/functions.h -fsyntax-only -verify %s |
Douglas Gregor | 3a2f7e4 | 2009-04-13 22:18:37 +0000 | [diff] [blame] | 3 | |
| 4 | // Test with pch. |
Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 5 | // RUN: %clang_cc1 -emit-pch -o %t %S/functions.h |
| 6 | // RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s |
Andy Gibbs | b42f200 | 2013-04-17 08:06:46 +0000 | [diff] [blame] | 7 | |
Douglas Gregor | 3a2f7e4 | 2009-04-13 22:18:37 +0000 | [diff] [blame] | 8 | int f0(int x0, int y0, ...) { return x0 + y0; } |
Andy Gibbs | b42f200 | 2013-04-17 08:06:46 +0000 | [diff] [blame] | 9 | |
Douglas Gregor | 3a2f7e4 | 2009-04-13 22:18:37 +0000 | [diff] [blame] | 10 | float *test_f1(int val, double x, double y) { |
| 11 | if (val > 5) |
| 12 | return f1(x, y); |
| 13 | else |
| 14 | return f1(x); // expected-error{{too few arguments to function call}} |
Andy Gibbs | b42f200 | 2013-04-17 08:06:46 +0000 | [diff] [blame] | 15 | // expected-note@functions.h:7{{'f1' declared here}} |
Douglas Gregor | 3a2f7e4 | 2009-04-13 22:18:37 +0000 | [diff] [blame] | 16 | } |
| 17 | |
| 18 | void test_g0(int *x, float * y) { |
Douglas Gregor | d4eea83 | 2010-04-09 00:35:39 +0000 | [diff] [blame] | 19 | g0(y); // expected-warning{{incompatible pointer types passing 'float *' to parameter of type 'int *'}} |
Andy Gibbs | b42f200 | 2013-04-17 08:06:46 +0000 | [diff] [blame] | 20 | // expected-note@functions.h:9{{passing argument to parameter here}} |
Douglas Gregor | 3a2f7e4 | 2009-04-13 22:18:37 +0000 | [diff] [blame] | 21 | g0(x); |
| 22 | } |
Douglas Gregor | 9123666 | 2009-12-22 18:11:50 +0000 | [diff] [blame] | 23 | |
| 24 | void __attribute__((noreturn)) test_abort(int code) { |
| 25 | do_abort(code); |
| 26 | } |
| 27 | |