blob: e2c5ff1f481e44e523808d9d3d6411958ef87f00 [file] [log] [blame]
Fariborz Jahanian743dda42011-04-25 18:49:15 +00001// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-apple-darwin9 %s
2
3#pragma ms_struct on
4
5#pragma ms_struct off
6
7#pragma ms_struct reset
8
9#pragma ms_struct // expected-warning {{incorrect use of '#pragma ms_struct on|off' - ignored}}
10
11#pragma ms_struct on top of spaghetti // expected-warning {{extra tokens at end of '#pragma ms_struct' - ignored}}
12
13struct foo
14{
15 int a;
16 int b;
17 char c;
18};
19
Fariborz Jahanian6b4e26b2011-04-26 17:54:40 +000020
21struct {
22 unsigned long bf_1 : 12;
23 unsigned long : 0;
24 unsigned long bf_2 : 12;
25} __attribute__((__ms_struct__)) t1;
26
27struct S {
Aaron Ballman17046b82013-11-27 19:16:55 +000028 double __attribute__((ms_struct)) d; // expected-warning {{'ms_struct' attribute only applies to struct or union}}
Fariborz Jahanian6b4e26b2011-04-26 17:54:40 +000029 unsigned long bf_1 : 12;
30 unsigned long : 0;
31 unsigned long bf_2 : 12;
32} __attribute__((ms_struct)) t2;
33
Eli Friedman9ee2d0472012-10-12 23:29:20 +000034enum
35{
36 A = 0,
37 B,
38 C
Aaron Ballman17046b82013-11-27 19:16:55 +000039} __attribute__((ms_struct)) e1; // expected-warning {{'ms_struct' attribute only applies to struct or union}}
Fariborz Jahanian6b4e26b2011-04-26 17:54:40 +000040
Fariborz Jahanian0586df42011-12-12 21:16:36 +000041// rdar://10513599
42#pragma ms_struct on
43
44typedef struct
45{
46void *pv;
47int l;
48} Foo;
49
50typedef struct
51{
52void *pv1;
53Foo foo;
54unsigned short fInited : 1;
Aaron Ballmanb80f94b2013-11-20 22:22:04 +000055void *pv2;
56} PackOddity;
Fariborz Jahanian0586df42011-12-12 21:16:36 +000057
58#pragma ms_struct off
59
60static int arr[sizeof(PackOddity) == 40 ? 1 : -1];
61
Aaron Ballmanfdd783a2014-03-31 18:18:43 +000062struct __declspec(ms_struct) bad { // expected-warning {{__declspec attribute 'ms_struct' is not supported}}
Aaron Ballmanb80f94b2013-11-20 22:22:04 +000063};