brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · e337953 Raw
61 lines · c
1// RUN: %clang_cc1 -triple i686-apple-darwin9 %s -fsyntax-only -verify2// expected-no-diagnostics3 4#include <stddef.h>5 6#pragma pack(4)7 8// Baseline9struct s0 {10  char f0;11  int  f1;12};13extern int a0[offsetof(struct s0, f1) == 4 ? 1 : -1];14 15#pragma pack(push, 2)16struct s1 {17  char f0;18  int  f1;19};20extern int a1[offsetof(struct s1, f1) == 2 ? 1 : -1];21#pragma pack(pop)22 23#pragma pack(1)24struct s3_0 {25  char f0;26  int f1;27};28#pragma pack()29struct s3_1 {30  char f0;31  int f1;32};33extern int a3_0[offsetof(struct s3_0, f1) == 1 ? 1 : -1];34extern int a3_1[offsetof(struct s3_1, f1) == 4 ? 1 : -1];35 36// pack(0) is like pack()37#pragma pack(1)38struct s4_0 {39  char f0;40  int f1;41};42#pragma pack(0)43struct s4_1 {44  char f0;45  int f1;46};47extern int a4_0[offsetof(struct s4_0, f1) == 1 ? 1 : -1];48extern int a4_1[offsetof(struct s4_1, f1) == 4 ? 1 : -1];49 50void f(void) {51  #pragma pack(push, 2)52  struct s5_0 {53    char f0;54    struct s2_4_0 { 55      int f0;56    } f1;57  };58  #pragma pack(pop)59  extern int s5_0[offsetof(struct s5_0, f1) == 2 ? 1 : -1];60}61