authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-01-05 20:29:14+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-01-06 19:17:47-05:00
log2da9e0060b0ab4cbb404f55e279606766439e0cd
tree8a2d8edefdd93ad6a14e389f00f846e2cd5317aa
parent1dc25d75506adbd7f011c362fbcac01c27e940f4
signature Commit is signed but in an unrecognized format.

Add explanation about weird clang behavior on windows


1 files changed, 19 insertions(+), 15 deletions(-)

test/translate_c.zig+19-15
......@@ -1471,21 +1471,25 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
14711471 \\}
14721472 });
14731473
1474 cases.add("type referenced struct",
1475 \\struct Foo {
1476 \\ struct Bar{
1477 \\ int b;
1478 \\ };
1479 \\ struct Bar c;
1480 \\};
1481 , &[_][]const u8{
1482 \\pub const struct_Bar = extern struct {
1483 \\ b: c_int,
1484 \\};
1485 \\pub const struct_Foo = extern struct {
1486 \\ c: struct_Bar,
1487 \\};
1488 });
1474 if (builtin.os != .windows) {
1475 // When clang uses the <arch>-windows-none triple it behaves as MSVC and
1476 // interprets the inner `struct Bar` as an anonymous structure
1477 cases.add("type referenced struct",
1478 \\struct Foo {
1479 \\ struct Bar{
1480 \\ int b;
1481 \\ };
1482 \\ struct Bar c;
1483 \\};
1484 , &[_][]const u8{
1485 \\pub const struct_Bar = extern struct {
1486 \\ b: c_int,
1487 \\};
1488 \\pub const struct_Foo = extern struct {
1489 \\ c: struct_Bar,
1490 \\};
1491 });
1492 }
14891493
14901494 cases.add("undefined array global",
14911495 \\int array[100] = {};