2011-04-26 02:49:15 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-apple-darwin9 %s
|
|
|
|
|
|
|
|
#pragma ms_struct on
|
|
|
|
|
|
|
|
#pragma ms_struct off
|
|
|
|
|
|
|
|
#pragma ms_struct reset
|
|
|
|
|
|
|
|
#pragma ms_struct // expected-warning {{incorrect use of '#pragma ms_struct on|off' - ignored}}
|
|
|
|
|
|
|
|
#pragma ms_struct on top of spaghetti // expected-warning {{extra tokens at end of '#pragma ms_struct' - ignored}}
|
|
|
|
|
|
|
|
struct foo
|
|
|
|
{
|
|
|
|
int a;
|
|
|
|
int b;
|
|
|
|
char c;
|
|
|
|
};
|
|
|
|
|
2011-04-27 01:54:40 +08:00
|
|
|
|
|
|
|
struct {
|
|
|
|
unsigned long bf_1 : 12;
|
|
|
|
unsigned long : 0;
|
|
|
|
unsigned long bf_2 : 12;
|
|
|
|
} __attribute__((__ms_struct__)) t1;
|
|
|
|
|
|
|
|
struct S {
|
2013-11-28 03:16:55 +08:00
|
|
|
double __attribute__((ms_struct)) d; // expected-warning {{'ms_struct' attribute only applies to struct or union}}
|
2011-04-27 01:54:40 +08:00
|
|
|
unsigned long bf_1 : 12;
|
|
|
|
unsigned long : 0;
|
|
|
|
unsigned long bf_2 : 12;
|
|
|
|
} __attribute__((ms_struct)) t2;
|
|
|
|
|
2012-10-13 07:29:20 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
A = 0,
|
|
|
|
B,
|
|
|
|
C
|
2013-11-28 03:16:55 +08:00
|
|
|
} __attribute__((ms_struct)) e1; // expected-warning {{'ms_struct' attribute only applies to struct or union}}
|
2011-04-27 01:54:40 +08:00
|
|
|
|
2011-12-13 05:16:36 +08:00
|
|
|
// rdar://10513599
|
|
|
|
#pragma ms_struct on
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
void *pv;
|
|
|
|
int l;
|
|
|
|
} Foo;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
void *pv1;
|
|
|
|
Foo foo;
|
|
|
|
unsigned short fInited : 1;
|
2013-11-21 06:22:04 +08:00
|
|
|
void *pv2;
|
|
|
|
} PackOddity;
|
2011-12-13 05:16:36 +08:00
|
|
|
|
|
|
|
#pragma ms_struct off
|
|
|
|
|
|
|
|
static int arr[sizeof(PackOddity) == 40 ? 1 : -1];
|
|
|
|
|
2014-04-01 02:18:43 +08:00
|
|
|
struct __declspec(ms_struct) bad { // expected-warning {{__declspec attribute 'ms_struct' is not supported}}
|
2013-11-21 06:22:04 +08:00
|
|
|
};
|