Charles Davis | 5a0164d | 2010-02-10 23:06:52 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple i386-apple-darwin10 -fsyntax-only -verify %s |
| 2 | |
| 3 | int a __attribute__((force_align_arg_pointer)); // expected-warning{{attribute only applies to function types}} |
| 4 | |
| 5 | // It doesn't matter where the attribute is located. |
| 6 | void b(void) __attribute__((force_align_arg_pointer)); |
| 7 | void __attribute__((force_align_arg_pointer)) c(void); |
| 8 | |
| 9 | // Functions only have to be declared force_align_arg_pointer once. |
| 10 | void b(void) {} |
| 11 | |
| 12 | // It doesn't matter which declaration has the attribute. |
| 13 | void d(void); |
| 14 | void __attribute__((force_align_arg_pointer)) d(void) {} |
| 15 | |
| 16 | // Attribute is ignored on function pointer types. |
Charles Davis | ab44216 | 2010-02-17 00:44:47 +0000 | [diff] [blame] | 17 | void (__attribute__((force_align_arg_pointer)) *p)(); |
Charles Davis | beaf5ed | 2010-02-18 04:39:19 +0000 | [diff] [blame] | 18 | typedef void (__attribute__((__force_align_arg_pointer__)) *p2)(); |
Charles Davis | e01c063 | 2010-02-18 04:56:59 +0000 | [diff] [blame] | 19 | // Attribute is also ignored on function typedefs. |
| 20 | typedef void __attribute__((force_align_arg_pointer)) e(void); |
Charles Davis | 5a0164d | 2010-02-10 23:06:52 +0000 | [diff] [blame] | 21 | |