| ... | @@ -72,7 +72,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -72,7 +72,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 72 | \\ _ = c"void foo(void)"; | 72 | \\ _ = c"void foo(void)"; |
| 73 | \\} | 73 | \\} |
| 74 | ); | 74 | ); |
| 75 | | 75 | |
| 76 | cases.add("ignore result", | 76 | cases.add("ignore result", |
| 77 | \\void foo() { | 77 | \\void foo() { |
| 78 | \\ int a; | 78 | \\ int a; |
| ... | @@ -648,11 +648,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -648,11 +648,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 648 | , | 648 | , |
| 649 | \\pub export fn and_or_none_bool(a: c_int, b: f32, c: ?*c_void) c_int { | 649 | \\pub export fn and_or_none_bool(a: c_int, b: f32, c: ?*c_void) c_int { |
| 650 | \\ if ((a != 0) and (b != 0)) return 0; | 650 | \\ if ((a != 0) and (b != 0)) return 0; |
| 651 | \\ if ((b != 0) and (c != 0)) return 1; | 651 | \\ if ((b != 0) and (c != null)) return 1; |
| 652 | \\ if ((a != 0) and (c != 0)) return 2; | 652 | \\ if ((a != 0) and (c != null)) return 2; |
| 653 | \\ if ((a != 0) or (b != 0)) return 3; | 653 | \\ if ((a != 0) or (b != 0)) return 3; |
| 654 | \\ if ((b != 0) or (c != 0)) return 4; | 654 | \\ if ((b != 0) or (c != null)) return 4; |
| 655 | \\ if ((a != 0) or (c != 0)) return 5; | 655 | \\ if ((a != 0) or (c != null)) return 5; |
| 656 | \\ return 6; | 656 | \\ return 6; |
| 657 | \\} | 657 | \\} |
| 658 | ); | 658 | ); |
| ... | @@ -832,7 +832,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -832,7 +832,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 832 | \\} | 832 | \\} |
| 833 | , | 833 | , |
| 834 | \\pub export fn foo() [*c]c_int { | 834 | \\pub export fn foo() [*c]c_int { |
| 835 | \\ return 0; | 835 | \\ return null; |
| 836 | \\} | 836 | \\} |
| 837 | ); | 837 | ); |
| 838 | | 838 | |
| ... | @@ -1360,7 +1360,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -1360,7 +1360,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1360 | \\ return !(a == 0); | 1360 | \\ return !(a == 0); |
| 1361 | \\ return !(a != 0); | 1361 | \\ return !(a != 0); |
| 1362 | \\ return !(b != 0); | 1362 | \\ return !(b != 0); |
| 1363 | \\ return !(c != 0); | 1363 | \\ return !(c != null); |
| 1364 | \\} | 1364 | \\} |
| 1365 | ); | 1365 | ); |
| 1366 | | 1366 | |
| ... | @@ -1417,7 +1417,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -1417,7 +1417,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1417 | \\pub fn if_none_bool(a: c_int, b: f32, c: ?*c_void, d: enum_SomeEnum) c_int { | 1417 | \\pub fn if_none_bool(a: c_int, b: f32, c: ?*c_void, d: enum_SomeEnum) c_int { |
| 1418 | \\ if (a != 0) return 0; | 1418 | \\ if (a != 0) return 0; |
| 1419 | \\ if (b != 0) return 1; | 1419 | \\ if (b != 0) return 1; |
| 1420 | \\ if (c != 0) return 2; | 1420 | \\ if (c != null) return 2; |
| 1421 | \\ if (d != @bitCast(enum_SomeEnum, @TagType(enum_SomeEnum)(0))) return 3; | 1421 | \\ if (d != @bitCast(enum_SomeEnum, @TagType(enum_SomeEnum)(0))) return 3; |
| 1422 | \\ return 4; | 1422 | \\ return 4; |
| 1423 | \\} | 1423 | \\} |
| ... | @@ -1434,7 +1434,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -1434,7 +1434,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1434 | \\pub fn while_none_bool(a: c_int, b: f32, c: ?*c_void) c_int { | 1434 | \\pub fn while_none_bool(a: c_int, b: f32, c: ?*c_void) c_int { |
| 1435 | \\ while (a != 0) return 0; | 1435 | \\ while (a != 0) return 0; |
| 1436 | \\ while (b != 0) return 1; | 1436 | \\ while (b != 0) return 1; |
| 1437 | \\ while (c != 0) return 2; | 1437 | \\ while (c != null) return 2; |
| 1438 | \\ return 3; | 1438 | \\ return 3; |
| 1439 | \\} | 1439 | \\} |
| 1440 | ); | 1440 | ); |
| ... | @@ -1450,7 +1450,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -1450,7 +1450,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1450 | \\pub fn for_none_bool(a: c_int, b: f32, c: ?*c_void) c_int { | 1450 | \\pub fn for_none_bool(a: c_int, b: f32, c: ?*c_void) c_int { |
| 1451 | \\ while (a != 0) return 0; | 1451 | \\ while (a != 0) return 0; |
| 1452 | \\ while (b != 0) return 1; | 1452 | \\ while (b != 0) return 1; |
| 1453 | \\ while (c != 0) return 2; | 1453 | \\ while (c != null) return 2; |
| 1454 | \\ return 3; | 1454 | \\ return 3; |
| 1455 | \\} | 1455 | \\} |
| 1456 | ); | 1456 | ); |
| ... | @@ -1581,7 +1581,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -1581,7 +1581,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1581 | \\ fn_int(&fn_int); | 1581 | \\ fn_int(&fn_int); |
| 1582 | \\ fn_ptr(42); | 1582 | \\ fn_ptr(42); |
| 1583 | \\} | 1583 | \\} |
| 1584 | , | 1584 | , |
| 1585 | \\pub extern fn fn_int(x: c_int) void; | 1585 | \\pub extern fn fn_int(x: c_int) void; |
| 1586 | \\pub extern fn fn_f32(x: f32) void; | 1586 | \\pub extern fn fn_f32(x: f32) void; |
| 1587 | \\pub extern fn fn_f64(x: f64) void; | 1587 | \\pub extern fn fn_f64(x: f64) void; |
| ... | @@ -1624,7 +1624,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -1624,7 +1624,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1624 | \\ long long *to_longlong = p; | 1624 | \\ long long *to_longlong = p; |
| 1625 | \\ } | 1625 | \\ } |
| 1626 | \\} | 1626 | \\} |
| 1627 | , | 1627 | , |
| 1628 | \\pub export fn test_ptr_cast() void { | 1628 | \\pub export fn test_ptr_cast() void { |
| 1629 | \\ var p: ?*c_void = undefined; | 1629 | \\ var p: ?*c_void = undefined; |
| 1630 | \\ { | 1630 | \\ { |