xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/x86-attr-force-align-arg-pointer.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple i386-apple-darwin10 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc int a __attribute__((force_align_arg_pointer)); // expected-warning{{attribute only applies to functions}}
4*f4a2713aSLionel Sambuc 
5*f4a2713aSLionel Sambuc // It doesn't matter where the attribute is located.
6*f4a2713aSLionel Sambuc void b(void) __attribute__((force_align_arg_pointer));
7*f4a2713aSLionel Sambuc void __attribute__((force_align_arg_pointer)) c(void);
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc // Functions only have to be declared force_align_arg_pointer once.
b(void)10*f4a2713aSLionel Sambuc void b(void) {}
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc // It doesn't matter which declaration has the attribute.
13*f4a2713aSLionel Sambuc void d(void);
d(void)14*f4a2713aSLionel Sambuc void __attribute__((force_align_arg_pointer)) d(void) {}
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc // Attribute is ignored on function pointer types.
17*f4a2713aSLionel Sambuc void (__attribute__((force_align_arg_pointer)) *p)();
18*f4a2713aSLionel Sambuc typedef void (__attribute__((__force_align_arg_pointer__)) *p2)();
19*f4a2713aSLionel Sambuc // Attribute is also ignored on function typedefs.
20*f4a2713aSLionel Sambuc typedef void __attribute__((force_align_arg_pointer)) e(void);
21*f4a2713aSLionel Sambuc 
22