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