]> git.lizzy.rs Git - rust.git/blob - src/test/run-make-fulldeps/extern-fn-with-packed-struct/test.c
Auto merge of #100968 - cjgillot:mir-upvar-vec, r=wesleywiser
[rust.git] / src / test / run-make-fulldeps / extern-fn-with-packed-struct / test.c
1 // Pragma needed cause of gcc bug on windows: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991
2
3 #include <assert.h>
4
5 #ifdef _MSC_VER
6 #pragma pack(push,1)
7 struct Foo {
8     char a;
9     short b;
10     char c;
11 };
12 #else
13 #pragma pack(1)
14 struct __attribute__((packed)) Foo {
15     char a;
16     short b;
17     char c;
18 };
19 #endif
20
21 struct Foo foo(struct Foo foo) {
22     assert(foo.a == 1);
23     assert(foo.b == 2);
24     assert(foo.c == 3);
25     return foo;
26 }