Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc %s -fsyntax-only -verify -pedantic -triple=i686-apple-darwin9 |
Eli Friedman | 1435202 | 2008-05-25 04:43:38 +0000 | [diff] [blame] | 2 | // This test needs to set the target because it uses __builtin_ia32_vec_ext_v4si |
Chris Lattner | 1b9a079 | 2007-12-20 00:26:33 +0000 | [diff] [blame] | 3 | |
| 4 | int test1(float a, int b) { |
| 5 | return __builtin_isless(a, b); |
| 6 | } |
| 7 | int test2(int a, int b) { |
| 8 | return __builtin_islessequal(a, b); // expected-error {{floating point type}} |
| 9 | } |
| 10 | |
| 11 | int test3(double a, float b) { |
| 12 | return __builtin_isless(a, b); |
| 13 | } |
| 14 | int test4(int* a, double b) { |
| 15 | return __builtin_islessequal(a, b); // expected-error {{floating point type}} |
| 16 | } |
| 17 | |
| 18 | int test5(float a, long double b) { |
| 19 | return __builtin_isless(a, b, b); // expected-error {{too many arguments}} |
| 20 | } |
| 21 | int test6(float a, long double b) { |
| 22 | return __builtin_islessequal(a); // expected-error {{too few arguments}} |
| 23 | } |
| 24 | |
| 25 | |
| 26 | #define CFSTR __builtin___CFStringMakeConstantString |
Chris Lattner | 5caa370 | 2009-05-08 06:58:22 +0000 | [diff] [blame^] | 27 | void test7() { |
Mike Stump | c561367 | 2009-04-02 00:04:12 +0000 | [diff] [blame] | 28 | CFSTR("\242"); |
Chris Lattner | 1b9a079 | 2007-12-20 00:26:33 +0000 | [diff] [blame] | 29 | CFSTR("\0"); // expected-warning {{ CFString literal contains NUL character }} |
Chris Lattner | b7b6115 | 2008-01-04 18:22:42 +0000 | [diff] [blame] | 30 | CFSTR(242); // expected-error {{ CFString literal is not a string constant }} expected-warning {{incompatible integer to pointer conversion}} |
Chris Lattner | 2c21a07 | 2008-11-21 18:44:24 +0000 | [diff] [blame] | 31 | CFSTR("foo", "bar"); // expected-error {{too many arguments to function call}} |
Chris Lattner | 1b9a079 | 2007-12-20 00:26:33 +0000 | [diff] [blame] | 32 | } |
| 33 | |
Chris Lattner | 95e2c71 | 2008-05-05 22:18:14 +0000 | [diff] [blame] | 34 | |
Eli Friedman | eb32fde | 2009-04-28 03:13:54 +0000 | [diff] [blame] | 35 | typedef __attribute__(( ext_vector_type(16) )) unsigned char uchar16; |
Chris Lattner | 95e2c71 | 2008-05-05 22:18:14 +0000 | [diff] [blame] | 36 | |
| 37 | // rdar://5905347 |
Chris Lattner | 5caa370 | 2009-05-08 06:58:22 +0000 | [diff] [blame^] | 38 | unsigned char test8( short v ) { |
Chris Lattner | 95e2c71 | 2008-05-05 22:18:14 +0000 | [diff] [blame] | 39 | uchar16 c; |
| 40 | return __builtin_ia32_vec_ext_v4si( c ); // expected-error {{too few arguments to function}} |
| 41 | } |
| 42 | |
Chris Lattner | 5caa370 | 2009-05-08 06:58:22 +0000 | [diff] [blame^] | 43 | |
| 44 | // atomics. |
| 45 | |
| 46 | unsigned char test9(short v) { |
| 47 | unsigned i, old; |
| 48 | |
| 49 | old = __sync_fetch_and_add(); // expected-error {{too few arguments to function call}} |
| 50 | old = __sync_fetch_and_add(&old); // expected-error {{too few arguments to function call}} |
| 51 | old = __sync_fetch_and_add((int**)0, 42i); // expected-error {{operand of type '_Complex int' cannot be cast to a pointer type}} expected-warning {{imaginary constants are an extension}} |
| 52 | } |