]> git.lizzy.rs Git - rust.git/blob - tests/run-make-fulldeps/extern-fn-with-packed-struct/test.c
Merge commit '598f0909568a51de8a2d1148f55a644fd8dffad0' into sync_cg_clif-2023-01-24
[rust.git] / tests / 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 }