PageRenderTime 24ms CodeModel.GetById 16ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/test/Sema/pragma-pack-and-options-align.c

http://github.com/jacob-carlborg/clang
C | 42 lines | 33 code | 7 blank | 2 comment | 5 complexity | 5f2ae3fd5353e44a5fe51e4a23cf8e3c MD5 | raw file
 1// RUN: %clang_cc1 -triple i686-apple-darwin9 %s -fsyntax-only -verify
 2
 3// Check that #pragma pack and #pragma options share the same stack.
 4
 5#pragma pack(push, 1)
 6struct s0 {
 7  char c;
 8  int x;
 9};
10extern int a[sizeof(struct s0) == 5 ? 1 : -1];
11
12#pragma options align=natural
13struct s1 {
14  char c;
15  int x;
16};
17extern int a[sizeof(struct s1) == 8 ? 1 : -1];
18
19#pragma options align=reset
20#pragma options align=native
21struct s1_1 {
22  char c;
23  int x;
24};
25extern int a[sizeof(struct s1_1) == 8 ? 1 : -1];
26
27#pragma pack(pop)
28struct s2 {
29  char c;
30  int x;
31};
32extern int a[sizeof(struct s2) == 5 ? 1 : -1];
33#pragma pack(pop)
34
35struct s3 {
36  char c;
37  int x;
38};
39extern int a[sizeof(struct s3) == 8 ? 1 : -1];
40
41/* expected-warning {{#pragma options align=reset failed: stack empty}} */ #pragma options align=reset
42/* expected-warning {{#pragma pack(pop, ...) failed: stack empty}} */ #pragma pack(pop)