PageRenderTime 56ms CodeModel.GetById 21ms RepoModel.GetById 0ms 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. // Check that #pragma pack and #pragma options share the same stack.
  3. #pragma pack(push, 1)
  4. struct s0 {
  5. char c;
  6. int x;
  7. };
  8. extern int a[sizeof(struct s0) == 5 ? 1 : -1];
  9. #pragma options align=natural
  10. struct s1 {
  11. char c;
  12. int x;
  13. };
  14. extern int a[sizeof(struct s1) == 8 ? 1 : -1];
  15. #pragma options align=reset
  16. #pragma options align=native
  17. struct s1_1 {
  18. char c;
  19. int x;
  20. };
  21. extern int a[sizeof(struct s1_1) == 8 ? 1 : -1];
  22. #pragma pack(pop)
  23. struct s2 {
  24. char c;
  25. int x;
  26. };
  27. extern int a[sizeof(struct s2) == 5 ? 1 : -1];
  28. #pragma pack(pop)
  29. struct s3 {
  30. char c;
  31. int x;
  32. };
  33. extern int a[sizeof(struct s3) == 8 ? 1 : -1];
  34. /* expected-warning {{#pragma options align=reset failed: stack empty}} */ #pragma options align=reset
  35. /* expected-warning {{#pragma pack(pop, ...) failed: stack empty}} */ #pragma pack(pop)