[llvm-commits] CVS: llvm/test/C++Frontend/2007-04-05-PackedBitFields-1.cpp 2007-04-05-PackedBitFieldsOverlap-2.cpp 2007-04-05-PackedBitFieldsOverlap.cpp 2007-04-05-PackedBitFieldsSmall.cpp 2007-04-05-StructPackedFieldUnpacked.cpp
Devang Patel
dpatel at apple.com
Thu Apr 5 10:14:38 PDT 2007
Changes in directory llvm/test/C++Frontend:
2007-04-05-PackedBitFields-1.cpp added (r1.1)
2007-04-05-PackedBitFieldsOverlap-2.cpp added (r1.1)
2007-04-05-PackedBitFieldsOverlap.cpp added (r1.1)
2007-04-05-PackedBitFieldsSmall.cpp added (r1.1)
2007-04-05-StructPackedFieldUnpacked.cpp added (r1.1)
---
Log message:
New tests for Packed structs.
---
Diffs of the changes: (+123 -0)
2007-04-05-PackedBitFields-1.cpp | 23 +++++++++++++++++++++++
2007-04-05-PackedBitFieldsOverlap-2.cpp | 24 ++++++++++++++++++++++++
2007-04-05-PackedBitFieldsOverlap.cpp | 24 ++++++++++++++++++++++++
2007-04-05-PackedBitFieldsSmall.cpp | 27 +++++++++++++++++++++++++++
2007-04-05-StructPackedFieldUnpacked.cpp | 25 +++++++++++++++++++++++++
5 files changed, 123 insertions(+)
Index: llvm/test/C++Frontend/2007-04-05-PackedBitFields-1.cpp
diff -c /dev/null llvm/test/C++Frontend/2007-04-05-PackedBitFields-1.cpp:1.1
*** /dev/null Thu Apr 5 12:14:31 2007
--- llvm/test/C++Frontend/2007-04-05-PackedBitFields-1.cpp Thu Apr 5 12:14:21 2007
***************
*** 0 ****
--- 1,23 ----
+ // RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+ #ifdef PACKED
+ #define P __attribute__((packed))
+ #else
+ #define P
+ #endif
+
+ struct P M_Packed {
+ unsigned int l_Packed;
+ unsigned short k_Packed : 6,
+ i_Packed : 15,
+ j_Packed : 11;
+
+ };
+
+ struct M_Packed sM_Packed;
+
+ int testM_Packed (void) {
+ struct M_Packed x;
+ return (x.i_Packed != 0);
+ }
+
Index: llvm/test/C++Frontend/2007-04-05-PackedBitFieldsOverlap-2.cpp
diff -c /dev/null llvm/test/C++Frontend/2007-04-05-PackedBitFieldsOverlap-2.cpp:1.1
*** /dev/null Thu Apr 5 12:14:38 2007
--- llvm/test/C++Frontend/2007-04-05-PackedBitFieldsOverlap-2.cpp Thu Apr 5 12:14:21 2007
***************
*** 0 ****
--- 1,24 ----
+ // RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+ #ifdef PACKED
+ #define P __attribute__((packed))
+ #else
+ #define P
+ #endif
+
+ struct P M_Packed {
+ unsigned long sorted : 1;
+ unsigned long from_array : 1;
+ unsigned long mixed_encoding : 1;
+ unsigned long encoding : 8;
+ unsigned long count : 21;
+
+ };
+
+ struct M_Packed sM_Packed;
+
+ int testM_Packed (void) {
+ struct M_Packed x;
+ return (x.count != 0);
+ }
+
Index: llvm/test/C++Frontend/2007-04-05-PackedBitFieldsOverlap.cpp
diff -c /dev/null llvm/test/C++Frontend/2007-04-05-PackedBitFieldsOverlap.cpp:1.1
*** /dev/null Thu Apr 5 12:14:38 2007
--- llvm/test/C++Frontend/2007-04-05-PackedBitFieldsOverlap.cpp Thu Apr 5 12:14:21 2007
***************
*** 0 ****
--- 1,24 ----
+ // RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+
+ #ifdef PACKED
+ #define P __attribute__((packed))
+ #else
+ #define P
+ #endif
+
+ struct P M_Packed {
+ unsigned int l_Packed;
+ unsigned short k_Packed : 6,
+ i_Packed : 15;
+ char c;
+
+ };
+
+ struct M_Packed sM_Packed;
+
+ int testM_Packed (void) {
+ struct M_Packed x;
+ return (x.i_Packed != 0);
+ }
+
Index: llvm/test/C++Frontend/2007-04-05-PackedBitFieldsSmall.cpp
diff -c /dev/null llvm/test/C++Frontend/2007-04-05-PackedBitFieldsSmall.cpp:1.1
*** /dev/null Thu Apr 5 12:14:38 2007
--- llvm/test/C++Frontend/2007-04-05-PackedBitFieldsSmall.cpp Thu Apr 5 12:14:21 2007
***************
*** 0 ****
--- 1,27 ----
+ // RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+
+ #ifdef PACKED
+ // This is an example where size of Packed struct is smaller then
+ // the size of bit field type.
+ #define P __attribute__((packed))
+ #else
+ #define P
+ #endif
+
+ struct P M_Packed {
+ unsigned long long X:50;
+ unsigned Y:2;
+ };
+
+ struct M_Packed sM_Packed;
+
+ int testM_Packed (void) {
+ struct M_Packed x;
+ return (0 != x.Y);
+ }
+
+ int testM_Packed2 (void) {
+ struct M_Packed x;
+ return (0 != x.X);
+ }
Index: llvm/test/C++Frontend/2007-04-05-StructPackedFieldUnpacked.cpp
diff -c /dev/null llvm/test/C++Frontend/2007-04-05-StructPackedFieldUnpacked.cpp:1.1
*** /dev/null Thu Apr 5 12:14:38 2007
--- llvm/test/C++Frontend/2007-04-05-StructPackedFieldUnpacked.cpp Thu Apr 5 12:14:21 2007
***************
*** 0 ****
--- 1,25 ----
+ // RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+ #ifdef PACKED
+ #define P __attribute__((packed))
+ #else
+ #define P
+ #endif
+
+ struct UnPacked {
+ int X;
+ int Y;
+ };
+
+ struct P M_Packed {
+ unsigned char A;
+ struct UnPacked B;
+ };
+
+ struct M_Packed sM_Packed;
+
+ int testM_Packed (void) {
+ struct M_Packed x;
+ return (x.B.Y != 0);
+ }
+
More information about the llvm-commits
mailing list