[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Sema / arm-layout.c
blob4b76515d625766c269bd6c7825f17e5a1f23fe88
1 // RUN: %clang_cc1 -triple armv7-unknown-unknown -target-abi apcs-gnu %s -verify
2 // RUN: %clang_cc1 -triple armv7-unknown-unknown -target-abi aapcs %s -verify
3 // expected-no-diagnostics
5 #define check(name, cond) int _##name##_check[(cond) ? 1 : -1]
7 struct s0 { char field0; double field1; };
8 #ifdef __ARM_EABI__
9 check(s0_size, sizeof(struct s0) == 16);
10 #else
11 check(s0_size, sizeof(struct s0) == 12);
12 #endif
14 struct s1 { char field0; long double field1; };
15 #ifdef __ARM_EABI__
16 check(s1_size, sizeof(struct s1) == 16);
17 #else
18 check(s1_size, sizeof(struct s1) == 12);
19 #endif
21 struct s2 {
22 short field0;
23 int field1 : 24;
24 char field2;
26 #ifdef __ARM_EABI__
27 check(s2_size, sizeof(struct s2) == 8);
28 check(s2_offset_0, __builtin_offsetof(struct s2, field0) == 0);
29 check(s2_offset_1, __builtin_offsetof(struct s2, field2) == 7);
30 #else
31 check(s2_size, sizeof(struct s2) == 6);
32 check(s2_offset_0, __builtin_offsetof(struct s2, field0) == 0);
33 check(s2_offset_1, __builtin_offsetof(struct s2, field2) == 5);
34 #endif
36 struct s3 {
37 short field0;
38 int field1 : 24 __attribute__((aligned(4)));
39 char field2;
41 check(s3_size, sizeof(struct s3) == 8);
42 check(s3_offset_0, __builtin_offsetof(struct s3, field0) == 0);
43 check(s3_offset_1, __builtin_offsetof(struct s3, field2) == 7);
45 struct s4 {
46 int field0 : 4;
48 #ifdef __ARM_EABI__
49 check(s4_size, sizeof(struct s4) == 4);
50 check(s4_align, __alignof(struct s4) == 4);
51 #else
52 check(s4_size, sizeof(struct s4) == 1);
53 check(s4_align, __alignof(struct s4) == 1);
54 #endif