cbe: update test cases

This commit is contained in:
Jacob Young 2022-10-24 11:32:31 -04:00
parent ab468d57e3
commit e470cf361f
4 changed files with 14 additions and 12 deletions

1
lib/include/zig.h vendored
View File

@ -3,6 +3,7 @@
#define __STDC_WANT_IEC_60559_TYPES_EXT__ #define __STDC_WANT_IEC_60559_TYPES_EXT__
#include <float.h> #include <float.h>
#include <limits.h> #include <limits.h>
#include <stddef.h>
#include <stdint.h> #include <stdint.h>
#if defined(__has_builtin) #if defined(__has_builtin)

View File

@ -506,7 +506,7 @@ fn main(c_argc: c_int, c_argv: [*c][*c]u8, c_envp: [*c][*c]u8) callconv(.C) c_in
} }
fn mainWithoutEnv(c_argc: c_int, c_argv: [*c][*c]u8) callconv(.C) c_int { fn mainWithoutEnv(c_argc: c_int, c_argv: [*c][*c]u8) callconv(.C) c_int {
std.os.argv = c_argv[0..@intCast(usize, c_argc)]; std.os.argv = @ptrCast([*][*:0]u8, c_argv)[0..@intCast(usize, c_argc)];
return @call(.{ .modifier = .always_inline }, callMain, .{}); return @call(.{ .modifier = .always_inline }, callMain, .{});
} }

View File

@ -791,6 +791,7 @@ pub const TestContext = struct {
.updates = std.ArrayList(Update).init(ctx.cases.allocator), .updates = std.ArrayList(Update).init(ctx.cases.allocator),
.output_mode = .Exe, .output_mode = .Exe,
.files = std.ArrayList(File).init(ctx.arena), .files = std.ArrayList(File).init(ctx.arena),
.link_libc = true,
}) catch @panic("out of memory"); }) catch @panic("out of memory");
return &ctx.cases.items[ctx.cases.items.len - 1]; return &ctx.cases.items[ctx.cases.items.len - 1];
} }

View File

@ -951,7 +951,7 @@ pub fn addCases(ctx: *TestContext) !void {
ctx.h("simple header", linux_x64, ctx.h("simple header", linux_x64,
\\export fn start() void{} \\export fn start() void{}
, ,
\\ZIG_EXTERN_C void start(void); \\zig_extern_c zig_void start(zig_void);
\\ \\
); );
ctx.h("header with single param function", linux_x64, ctx.h("header with single param function", linux_x64,
@ -959,7 +959,7 @@ pub fn addCases(ctx: *TestContext) !void {
\\ _ = a; \\ _ = a;
\\} \\}
, ,
\\ZIG_EXTERN_C void start(uint8_t a0); \\zig_extern_c zig_void start(zig_u8 const a0);
\\ \\
); );
ctx.h("header with multiple param function", linux_x64, ctx.h("header with multiple param function", linux_x64,
@ -967,25 +967,25 @@ pub fn addCases(ctx: *TestContext) !void {
\\ _ = a; _ = b; _ = c; \\ _ = a; _ = b; _ = c;
\\} \\}
, ,
\\ZIG_EXTERN_C void start(uint8_t a0, uint8_t a1, uint8_t a2); \\zig_extern_c zig_void start(zig_u8 const a0, zig_u8 const a1, zig_u8 const a2);
\\ \\
); );
ctx.h("header with u32 param function", linux_x64, ctx.h("header with u32 param function", linux_x64,
\\export fn start(a: u32) void{ _ = a; } \\export fn start(a: u32) void{ _ = a; }
, ,
\\ZIG_EXTERN_C void start(uint32_t a0); \\zig_extern_c zig_void start(zig_u32 const a0);
\\ \\
); );
ctx.h("header with usize param function", linux_x64, ctx.h("header with usize param function", linux_x64,
\\export fn start(a: usize) void{ _ = a; } \\export fn start(a: usize) void{ _ = a; }
, ,
\\ZIG_EXTERN_C void start(uintptr_t a0); \\zig_extern_c zig_void start(zig_usize const a0);
\\ \\
); );
ctx.h("header with bool param function", linux_x64, ctx.h("header with bool param function", linux_x64,
\\export fn start(a: bool) void{_ = a;} \\export fn start(a: bool) void{_ = a;}
, ,
\\ZIG_EXTERN_C void start(bool a0); \\zig_extern_c zig_void start(zig_bool const a0);
\\ \\
); );
ctx.h("header with noreturn function", linux_x64, ctx.h("header with noreturn function", linux_x64,
@ -993,7 +993,7 @@ pub fn addCases(ctx: *TestContext) !void {
\\ unreachable; \\ unreachable;
\\} \\}
, ,
\\ZIG_EXTERN_C zig_noreturn void start(void); \\zig_extern_c zig_noreturn start(zig_void);
\\ \\
); );
ctx.h("header with multiple functions", linux_x64, ctx.h("header with multiple functions", linux_x64,
@ -1001,15 +1001,15 @@ pub fn addCases(ctx: *TestContext) !void {
\\export fn b() void{} \\export fn b() void{}
\\export fn c() void{} \\export fn c() void{}
, ,
\\ZIG_EXTERN_C void a(void); \\zig_extern_c zig_void a(zig_void);
\\ZIG_EXTERN_C void b(void); \\zig_extern_c zig_void b(zig_void);
\\ZIG_EXTERN_C void c(void); \\zig_extern_c zig_void c(zig_void);
\\ \\
); );
ctx.h("header with multiple includes", linux_x64, ctx.h("header with multiple includes", linux_x64,
\\export fn start(a: u32, b: usize) void{ _ = a; _ = b; } \\export fn start(a: u32, b: usize) void{ _ = a; _ = b; }
, ,
\\ZIG_EXTERN_C void start(uint32_t a0, uintptr_t a1); \\zig_extern_c zig_void start(zig_u32 const a0, zig_usize const a1);
\\ \\
); );
} }