Skip to content

Commit 0957597

Browse files
committed
GCC only implements #pragma ms_struct on Darwin, so don't try to test it
on other platforms. llvm-svn: 133058
1 parent f8dfd95 commit 0957597

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

SingleSource/UnitTests/ms_struct-bitfield-init-1.c

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
#define ATTR __attribute__((__ms_struct__))
44

5+
// GCC only implements #pragma ms_struct on Darwin.
6+
#define HAVE_PRAGMA_MS_STRUCT (defined(__clang__) || defined(__MACH__))
7+
58
struct {
69
unsigned int bf_1 : 12;
710
unsigned int : 0;
@@ -17,6 +20,7 @@ struct
1720
} ATTR t2 = {3,4};
1821
static int a2[(sizeof(t2) == 4) -1];
1922

23+
#if HAVE_PRAGMA_MS_STRUCT
2024
#pragma ms_struct on
2125
struct
2226
{
@@ -26,6 +30,7 @@ struct
2630
} t3 = {5,6};
2731
#pragma ms_struct off
2832
static int a3[(sizeof(t3) == 4) -1];
33+
#endif
2934

3035
struct
3136
{
@@ -85,8 +90,10 @@ int main() {
8590
abort();
8691
if (t2.foo != 3 || t2.bar != 4)
8792
abort();
93+
#if HAVE_PRAGMA_MS_STRUCT
8894
if (t3.foo != 5 || t3.bar != 6)
8995
abort();
96+
#endif
9097
if (t5.foo != 7 || t5.bar != 8)
9198
abort();
9299
if (t6.foo != 5 || t6.bar != 10)

0 commit comments

Comments
 (0)