Daniel Dunbar | ea75a82 | 2010-05-27 00:04:40 +0000 | [diff] [blame^] | 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) |
| 6 | struct s0 { |
| 7 | char c; |
| 8 | int x; |
| 9 | }; |
| 10 | extern int a[sizeof(struct s0) == 5 ? 1 : -1]; |
| 11 | |
| 12 | #pragma options align=natural |
| 13 | struct s1 { |
| 14 | char c; |
| 15 | int x; |
| 16 | }; |
| 17 | extern int a[sizeof(struct s1) == 8 ? 1 : -1]; |
| 18 | |
| 19 | #pragma pack(pop) |
| 20 | struct s2 { |
| 21 | char c; |
| 22 | int x; |
| 23 | }; |
| 24 | extern int a[sizeof(struct s2) == 5 ? 1 : -1]; |
| 25 | #pragma pack(pop) |
| 26 | |
| 27 | struct s3 { |
| 28 | char c; |
| 29 | int x; |
| 30 | }; |
| 31 | extern int a[sizeof(struct s3) == 8 ? 1 : -1]; |
| 32 | |
| 33 | /* expected-warning {{#pragma options align=reset failed: stack empty}} */ #pragma options align=reset |
| 34 | /* expected-warning {{#pragma pack(pop, ...) failed: stack empty}} */ #pragma pack(pop) |