diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-03-01 15:26:41 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-03-01 15:26:41 -0700 |
| commit | 5df091fea98e91536f95e3b4bd5bcb0881f06989 (patch) | |
| tree | 72e34976d9bf0119a1f72cc9f991192c558de9c1 /test/run_tests.cpp | |
| parent | 660a50661b22b279fed548387d19ffcddb031b23 (diff) | |
| download | zig-5df091fea98e91536f95e3b4bd5bcb0881f06989.tar.gz zig-5df091fea98e91536f95e3b4bd5bcb0881f06989.zip | |
c_void is provided outside of C imports
Diffstat (limited to 'test/run_tests.cpp')
| -rw-r--r-- | test/run_tests.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp index a87fe78c13..34d4e46792 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -1095,7 +1095,7 @@ pub fn main(args: [][]u8) -> %void { add_simple_case_libc("expose function pointer to C land", R"SOURCE( const c = @c_import(@c_include("stdlib.h")); -export fn compare_fn(a: ?&const c.c_void, b: ?&const c.c_void) -> c_int { +export fn compare_fn(a: ?&const c_void, b: ?&const c_void) -> c_int { const a_int = (&i32)(a ?? unreachable{}); const b_int = (&i32)(b ?? unreachable{}); if (*a_int < *b_int) { @@ -1110,7 +1110,7 @@ export fn compare_fn(a: ?&const c.c_void, b: ?&const c.c_void) -> c_int { export fn main(args: c_int, argv: &&u8) -> c_int { var array = []i32 { 1, 7, 3, 2, 0, 9, 4, 8, 6, 5 }; - c.qsort((&c.c_void)(&array[0]), c_ulong(array.len), @sizeof(i32), compare_fn); + c.qsort((&c_void)(&array[0]), c_ulong(array.len), @sizeof(i32), compare_fn); for (array) |item, i| { if (item != i) { @@ -1802,8 +1802,7 @@ pub const Foo1 = enum_Foo._1;)OUTPUT", add_parseh_case("restrict -> noalias", R"SOURCE( void foo(void *restrict bar, void *restrict); - )SOURCE", 1, R"OUTPUT(pub type c_void = u8; -pub extern fn foo(noalias bar: ?&c_void, noalias arg1: ?&c_void);)OUTPUT"); + )SOURCE", 1, R"OUTPUT(pub extern fn foo(noalias bar: ?&c_void, noalias arg1: ?&c_void);)OUTPUT"); add_parseh_case("simple struct", R"SOURCE( struct Foo { @@ -1916,8 +1915,7 @@ struct Bar { add_parseh_case("typedef void", R"SOURCE( typedef void Foo; Foo fun(Foo *a); - )SOURCE", 3, - "pub type c_void = u8;", + )SOURCE", 2, "pub const Foo = c_void;", "pub extern fn fun(a: ?&c_void);"); |
