Rafael Espindola | 2219fc5 | 2013-05-14 12:45:47 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple armv7 -fsyntax-only -verify %s |
Logan Chien | 57086ce | 2012-10-10 06:56:20 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -triple armv7 -target-abi apcs-gnu \ |
Rafael Espindola | 2219fc5 | 2013-05-14 12:45:47 +0000 | [diff] [blame] | 3 | // RUN: -fsyntax-only -verify %s |
Daniel Dunbar | 999daa5 | 2010-07-16 00:31:23 +0000 | [diff] [blame] | 4 | |
Rafael Espindola | 0633865 | 2013-05-14 18:06:10 +0000 | [diff] [blame] | 5 | void f(void *a, void *b) { |
| 6 | __clear_cache(); // expected-error {{too few arguments to function call, expected 2, have 0}} // expected-note {{'__clear_cache' is a builtin with type 'void (void *, void *)}} |
Rafael Espindola | 2219fc5 | 2013-05-14 12:45:47 +0000 | [diff] [blame] | 7 | __clear_cache(a); // expected-error {{too few arguments to function call, expected 2, have 1}} |
| 8 | __clear_cache(a, b); |
| 9 | } |
| 10 | |
Rafael Espindola | 0633865 | 2013-05-14 18:06:10 +0000 | [diff] [blame] | 11 | void __clear_cache(char*, char*); // expected-error {{conflicting types for '__clear_cache'}} |
| 12 | void __clear_cache(void*, void*); |
Daniel Dunbar | 999daa5 | 2010-07-16 00:31:23 +0000 | [diff] [blame] | 13 | |
Logan Chien | 57086ce | 2012-10-10 06:56:20 +0000 | [diff] [blame] | 14 | #if defined(__ARM_PCS) || defined(__ARM_EABI__) |
| 15 | // va_list on ARM AAPCS is struct { void* __ap }. |
| 16 | void test1() { |
| 17 | __builtin_va_list ptr; |
| 18 | ptr.__ap = "x"; |
| 19 | *(ptr.__ap) = '0'; // expected-error {{incomplete type 'void' is not assignable}} |
| 20 | } |
| 21 | #else |
| 22 | // va_list on ARM apcs-gnu is void*. |
| 23 | void test1() { |
| 24 | __builtin_va_list ptr; |
| 25 | ptr.__ap = "x"; // expected-error {{member reference base type '__builtin_va_list' is not a structure or union}} |
| 26 | *(ptr.__ap) = '0';// expected-error {{member reference base type '__builtin_va_list' is not a structure or union}} |
| 27 | } |
| 28 | |
John McCall | e155a3d | 2011-05-09 02:19:37 +0000 | [diff] [blame] | 29 | void test2() { |
| 30 | __builtin_va_list ptr = "x"; |
| 31 | *ptr = '0'; // expected-error {{incomplete type 'void' is not assignable}} |
| 32 | } |
Logan Chien | 57086ce | 2012-10-10 06:56:20 +0000 | [diff] [blame] | 33 | |
| 34 | #endif |