Home | History | Annotate | Download | only in Sema
      1 // 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 
     13 struct foo
     14 {
     15   int a;
     16   int b;
     17   char c;
     18 };
     19 
     20 
     21 struct {
     22                    unsigned long bf_1 : 12;
     23                    unsigned long : 0;
     24                    unsigned long bf_2 : 12;
     25 } __attribute__((__ms_struct__)) t1;
     26 
     27 struct S {
     28 		   double __attribute__((ms_struct)) d;	// expected-warning {{'ms_struct' attribute ignored}}
     29                    unsigned long bf_1 : 12;
     30                    unsigned long : 0;
     31                    unsigned long bf_2 : 12;
     32 } __attribute__((ms_struct)) t2;
     33 
     34 
     35 // rdar://10513599
     36 #pragma ms_struct on
     37 
     38 typedef struct
     39 {
     40 void *pv;
     41 int l;
     42 } Foo;
     43 
     44 typedef struct
     45 {
     46 void *pv1;
     47 Foo foo;
     48 unsigned short fInited : 1;
     49 void *pv2;
     50 } PackOddity;
     51 
     52 #pragma ms_struct off
     53 
     54 static int arr[sizeof(PackOddity) == 40 ? 1 : -1];
     55 
     56