Skip to content

Commit

Permalink
Add explanation about weird clang behavior on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonBoy committed Jan 5, 2020
1 parent 0597115 commit 4013f49
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions test/translate_c.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1428,21 +1428,25 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
\\}
});

cases.add("type referenced struct",
\\struct Foo {
\\ struct Bar{
\\ int b;
\\ };
\\ struct Bar c;
\\};
, &[_][]const u8{
\\pub const struct_Bar = extern struct {
\\ b: c_int,
\\};
\\pub const struct_Foo = extern struct {
\\ c: struct_Bar,
\\};
});
if (builtin.os != .windows) {
// When clang uses the <arch>-windows-none triple it behaves as MSVC and
// interprets the inner `struct Bar` as an anonymous structure
cases.add("type referenced struct",
\\struct Foo {
\\ struct Bar{
\\ int b;
\\ };
\\ struct Bar c;
\\};
, &[_][]const u8{
\\pub const struct_Bar = extern struct {
\\ b: c_int,
\\};
\\pub const struct_Foo = extern struct {
\\ c: struct_Bar,
\\};
});
}

cases.add("undefined array global",
\\int array[100] = {};
Expand Down

0 comments on commit 4013f49

Please sign in to comment.