We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f8dfd95 commit 0957597Copy full SHA for 0957597
SingleSource/UnitTests/ms_struct-bitfield-init-1.c
@@ -2,6 +2,9 @@
2
3
#define ATTR __attribute__((__ms_struct__))
4
5
+// GCC only implements #pragma ms_struct on Darwin.
6
+#define HAVE_PRAGMA_MS_STRUCT (defined(__clang__) || defined(__MACH__))
7
+
8
struct {
9
unsigned int bf_1 : 12;
10
unsigned int : 0;
@@ -17,6 +20,7 @@ struct
17
20
} ATTR t2 = {3,4};
18
21
static int a2[(sizeof(t2) == 4) -1];
19
22
23
+#if HAVE_PRAGMA_MS_STRUCT
24
#pragma ms_struct on
25
struct
26
{
@@ -26,6 +30,7 @@ struct
30
} t3 = {5,6};
27
31
#pragma ms_struct off
28
32
static int a3[(sizeof(t3) == 4) -1];
33
+#endif
29
34
35
36
@@ -85,8 +90,10 @@ int main() {
85
90
abort();
86
91
if (t2.foo != 3 || t2.bar != 4)
87
92
93
88
94
if (t3.foo != 5 || t3.bar != 6)
89
95
96
97
if (t5.foo != 7 || t5.bar != 8)
98
99
if (t6.foo != 5 || t6.bar != 10)
0 commit comments