John McCall | ed14ad2 | 2011-03-08 04:17:03 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s |
Anders Carlsson | c7c2070 | 2008-08-24 16:33:25 +0000 | [diff] [blame] | 2 | static id __attribute((objc_gc(weak))) a; |
| 3 | static id __attribute((objc_gc(strong))) b; |
| 4 | |
| 5 | static id __attribute((objc_gc())) c; // expected-error{{'objc_gc' attribute requires parameter 1 to be a string}} |
| 6 | static id __attribute((objc_gc(123))) d; // expected-error{{'objc_gc' attribute requires parameter 1 to be a string}} |
John McCall | 80ee596 | 2011-03-02 12:15:05 +0000 | [diff] [blame] | 7 | static id __attribute((objc_gc(foo, 456))) e; // expected-error{{attribute takes one argument}} |
Anders Carlsson | c7c2070 | 2008-08-24 16:33:25 +0000 | [diff] [blame] | 8 | static id __attribute((objc_gc(hello))) f; // expected-warning{{'objc_gc' attribute argument not supported: 'hello'}} |
John McCall | ed14ad2 | 2011-03-08 04:17:03 +0000 | [diff] [blame] | 9 | |
| 10 | static int __attribute__((objc_gc(weak))) g; // expected-warning {{'objc_gc' only applies to pointer types; type here is 'int'}} |
| 11 | |
| 12 | static __weak int h; // expected-warning {{'__weak' only applies to pointer types; type here is 'int'}} |
John McCall | 462c055 | 2011-03-08 07:59:04 +0000 | [diff] [blame^] | 13 | |
| 14 | // TODO: it would be great if this reported as __weak |
| 15 | #define WEAK __weak |
| 16 | static WEAK int h; // expected-warning {{'objc_gc' only applies to pointer types; type here is 'int'}} |
| 17 | |
| 18 | /* expected-warning {{'__weak' only applies to pointer types; type here is 'int'}}*/ static __we\ |
| 19 | ak int i; |