summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/struct-packed-align.c
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2008-05-30 09:31:38 +0000
committerEli Friedman <eli.friedman@gmail.com>2008-05-30 09:31:38 +0000
commit3df5efe83e295a9d5856f4aa57de26bc1c4a66b6 (patch)
tree0e6184fc73b4a528618913c7ea10c3a15824581e /clang/test/Sema/struct-packed-align.c
parentb0aa65125944f2f8ec47d1d8bf6dcf4eb15c7628 (diff)
downloadbcm5719-llvm-3df5efe83e295a9d5856f4aa57de26bc1c4a66b6.tar.gz
bcm5719-llvm-3df5efe83e295a9d5856f4aa57de26bc1c4a66b6.zip
Cleanup/refactoring of Sema struct layout. This patch unifies the struct
and union codepaths and fixes some minor bugs. I'm reasonably confident this is accurate, at least for X86. I'll correct any bugs as I find them; I haven't found any for a while, though. llvm-svn: 51762
Diffstat (limited to 'clang/test/Sema/struct-packed-align.c')
-rw-r--r--clang/test/Sema/struct-packed-align.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/Sema/struct-packed-align.c b/clang/test/Sema/struct-packed-align.c
index f759e37a1df..6398cd3993c 100644
--- a/clang/test/Sema/struct-packed-align.c
+++ b/clang/test/Sema/struct-packed-align.c
@@ -69,3 +69,23 @@ struct packedtest {
int ted_likes_cheese;
void *args[] __attribute__((packed));
};
+
+// Packed union
+union __attribute__((packed)) au4 {char c; int x;};
+extern int h1[sizeof(union au4) == 4 ? 1 : -1];
+extern int h2[__alignof(union au4) == 1 ? 1 : -1];
+
+// Aligned union
+union au5 {__attribute__((aligned(4))) char c;};
+extern int h1[sizeof(union au5) == 4 ? 1 : -1];
+extern int h2[__alignof(union au5) == 4 ? 1 : -1];
+
+// Alignment+packed
+struct as6 {char c; __attribute__((packed, aligned(2))) int x;};
+extern int i1[sizeof(struct as6) == 6 ? 1 : -1];
+extern int i2[__alignof(struct as6) == 2 ? 1 : -1];
+
+union au6 {char c; __attribute__((packed, aligned(2))) int x;};
+extern int k1[sizeof(union au6) == 4 ? 1 : -1];
+extern int k2[__alignof(union au6) == 2 ? 1 : -1];
+
OpenPOWER on IntegriCloud