Home | History | Annotate | Download | only in Sema
      1 // RUN: %clang_cc1 -triple i686-apple-darwin9 %s -fsyntax-only -verify
      2 // expected-no-diagnostics
      3 
      4 // Stack: [], Alignment: 8
      5 
      6 #pragma pack(push, 1)
      7 // Stack: [8], Alignment: 1
      8 
      9 #pragma pack(push, 4)
     10 // Stack: [8, 1], Alignment: 4
     11 
     12 // Note that this differs from gcc; pack() in gcc appears to pop the
     13 // top stack entry and resets the current alignment. This is both
     14 // inconsistent with MSVC, and the gcc documentation. In other cases,
     15 // for example changing this to pack(8), I don't even understand what gcc
     16 // is doing.
     17 
     18 #pragma pack()
     19 // Stack: [8, 1], Alignment: 8
     20 
     21 #pragma pack(pop)
     22 // Stack: [8], Alignment: 1
     23 struct s0 {
     24   char f0;
     25   short f1;
     26 };
     27 int a[sizeof(struct s0) == 3 ? 1 : -1];
     28 
     29 #pragma pack(pop)
     30 // Stack: [], Alignment: 8
     31 struct s1 {
     32   char f0;
     33   short f1;
     34 };
     35 int b[sizeof(struct s1) == 4 ? 1 : -1];
     36