[cfe-commits] r47217 - /cfe/trunk/test/Sema/struct-packed-align.c

Anders Carlsson andersca at mac.com
Sat Feb 16 11:51:36 PST 2008


Author: andersca
Date: Sat Feb 16 13:51:36 2008
New Revision: 47217

URL: http://llvm.org/viewvc/llvm-project?rev=47217&view=rev
Log:
Add more tests

Modified:
    cfe/trunk/test/Sema/struct-packed-align.c

Modified: cfe/trunk/test/Sema/struct-packed-align.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/struct-packed-align.c?rev=47217&r1=47216&r2=47217&view=diff

==============================================================================
--- cfe/trunk/test/Sema/struct-packed-align.c (original)
+++ cfe/trunk/test/Sema/struct-packed-align.c Sat Feb 16 13:51:36 2008
@@ -1,5 +1,6 @@
 // RUN: clang %s -fsyntax-only -verify
 
+// Packed structs.
 struct s {
     char a;
     int b  __attribute__((packed));
@@ -7,6 +8,9 @@
     int d;
 };
 
+extern int a1[sizeof(struct s) == 12 ? 1 : -1];
+extern int a2[__alignof(struct s) == 4 ? 1 : -1];
+
 struct __attribute__((packed)) packed_s {
     char a;
     int b  __attribute__((packed));
@@ -14,24 +18,47 @@
     int d;
 };
 
+extern int b1[sizeof(struct packed_s) == 10 ? 1 : -1];
+extern int b2[__alignof(struct packed_s) == 1 ? 1 : -1];
+
 struct fas {
     char a;
     int b[];
 };
 
+extern int c1[sizeof(struct fas) == 4 ? 1 : -1];
+extern int c2[__alignof(struct fas) == 4 ? 1 : -1];
+
 struct __attribute__((packed)) packed_fas {
     char a;
     int b[];
 };
 
-extern int a1[sizeof(struct s) == 12 ? 1 : -1];
-extern int a2[__alignof(struct s) == 4 ? 1 : -1];
+extern int d1[sizeof(struct packed_fas) == 1 ? 1 : -1];
+extern int d2[__alignof(struct packed_fas) == 1 ? 1 : -1];
 
-extern int b1[sizeof(struct packed_s) == 10 ? 1 : -1];
-extern int b2[__alignof(struct packed_s) == 1 ? 1 : -1];
+// Alignment
 
-extern int c1[sizeof(struct fas) == 4 ? 1 : -1];
-extern int c2[__alignof(struct fas) == 4 ? 1 : -1];
+struct __attribute__((aligned(8))) as1 {
+    char c;
+};
 
-extern int d1[sizeof(struct packed_fas) == 1 ? 1 : -1];
-extern int d2[__alignof(struct packed_fas) == 1 ? 1 : -1];
+extern int e1[sizeof(struct as1) == 8 ? 1 : -1];
+extern int e2[__alignof(struct as1) == 8 ? 1 : -1];
+
+struct as2 {
+    char c;
+    int __attribute__((aligned(8))) a;
+};
+
+extern int f1[sizeof(struct as2) == 16 ? 1 : -1];
+extern int f2[__alignof(struct as2) == 8 ? 1 : -1];
+
+struct __attribute__((packed)) as3 {
+    char c;
+    int a;
+    int __attribute__((aligned(8))) b;
+};
+
+extern int g1[sizeof(struct as3) == 16 ? 1 : -1];
+extern int g2[__alignof(struct as3) == 8 ? 1 : -1];





More information about the cfe-commits mailing list