authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2022-10-24 11:32:31-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2022-10-25 05:11:29-04:00
loge470cf361fb190863341c8859eccf9edda6d122c
tree1c21c32a54b06a7fcfcb339771d7f183ba004d5b
parentab468d57e3af5d158dfbe0229cc451ce62dd80dc

cbe: update test cases


4 files changed, 14 insertions(+), 12 deletions(-)

lib/include/zig.h+1
...@@ -3,6 +3,7 @@...@@ -3,6 +3,7 @@
3#define __STDC_WANT_IEC_60559_TYPES_EXT__3#define __STDC_WANT_IEC_60559_TYPES_EXT__
4#include <float.h>4#include <float.h>
5#include <limits.h>5#include <limits.h>
6#include <stddef.h>
6#include <stdint.h>7#include <stdint.h>
78
8#if defined(__has_builtin)9#if defined(__has_builtin)
lib/std/start.zig+1-1
...@@ -506,7 +506,7 @@ fn main(c_argc: c_int, c_argv: [*c][*c]u8, c_envp: [*c][*c]u8) callconv(.C) c_in...@@ -506,7 +506,7 @@ fn main(c_argc: c_int, c_argv: [*c][*c]u8, c_envp: [*c][*c]u8) callconv(.C) c_in
506}506}
507507
508fn mainWithoutEnv(c_argc: c_int, c_argv: [*c][*c]u8) callconv(.C) c_int {508fn mainWithoutEnv(c_argc: c_int, c_argv: [*c][*c]u8) callconv(.C) c_int {
509 std.os.argv = c_argv[0..@intCast(usize, c_argc)];509 std.os.argv = @ptrCast([*][*:0]u8, c_argv)[0..@intCast(usize, c_argc)];
510 return @call(.{ .modifier = .always_inline }, callMain, .{});510 return @call(.{ .modifier = .always_inline }, callMain, .{});
511}511}
512512
src/test.zig+1
...@@ -791,6 +791,7 @@ pub const TestContext = struct {...@@ -791,6 +791,7 @@ pub const TestContext = struct {
791 .updates = std.ArrayList(Update).init(ctx.cases.allocator),791 .updates = std.ArrayList(Update).init(ctx.cases.allocator),
792 .output_mode = .Exe,792 .output_mode = .Exe,
793 .files = std.ArrayList(File).init(ctx.arena),793 .files = std.ArrayList(File).init(ctx.arena),
794 .link_libc = true,
794 }) catch @panic("out of memory");795 }) catch @panic("out of memory");
795 return &ctx.cases.items[ctx.cases.items.len - 1];796 return &ctx.cases.items[ctx.cases.items.len - 1];
796 }797 }
test/stage2/cbe.zig+11-11
...@@ -951,7 +951,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -951,7 +951,7 @@ pub fn addCases(ctx: *TestContext) !void {
951 ctx.h("simple header", linux_x64,951 ctx.h("simple header", linux_x64,
952 \\export fn start() void{}952 \\export fn start() void{}
953 ,953 ,
954 \\ZIG_EXTERN_C void start(void);954 \\zig_extern_c zig_void start(zig_void);
955 \\955 \\
956 );956 );
957 ctx.h("header with single param function", linux_x64,957 ctx.h("header with single param function", linux_x64,
...@@ -959,7 +959,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -959,7 +959,7 @@ pub fn addCases(ctx: *TestContext) !void {
959 \\ _ = a;959 \\ _ = a;
960 \\}960 \\}
961 ,961 ,
962 \\ZIG_EXTERN_C void start(uint8_t a0);962 \\zig_extern_c zig_void start(zig_u8 const a0);
963 \\963 \\
964 );964 );
965 ctx.h("header with multiple param function", linux_x64,965 ctx.h("header with multiple param function", linux_x64,
...@@ -967,25 +967,25 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -967,25 +967,25 @@ pub fn addCases(ctx: *TestContext) !void {
967 \\ _ = a; _ = b; _ = c;967 \\ _ = a; _ = b; _ = c;
968 \\}968 \\}
969 ,969 ,
970 \\ZIG_EXTERN_C void start(uint8_t a0, uint8_t a1, uint8_t a2);970 \\zig_extern_c zig_void start(zig_u8 const a0, zig_u8 const a1, zig_u8 const a2);
971 \\971 \\
972 );972 );
973 ctx.h("header with u32 param function", linux_x64,973 ctx.h("header with u32 param function", linux_x64,
974 \\export fn start(a: u32) void{ _ = a; }974 \\export fn start(a: u32) void{ _ = a; }
975 ,975 ,
976 \\ZIG_EXTERN_C void start(uint32_t a0);976 \\zig_extern_c zig_void start(zig_u32 const a0);
977 \\977 \\
978 );978 );
979 ctx.h("header with usize param function", linux_x64,979 ctx.h("header with usize param function", linux_x64,
980 \\export fn start(a: usize) void{ _ = a; }980 \\export fn start(a: usize) void{ _ = a; }
981 ,981 ,
982 \\ZIG_EXTERN_C void start(uintptr_t a0);982 \\zig_extern_c zig_void start(zig_usize const a0);
983 \\983 \\
984 );984 );
985 ctx.h("header with bool param function", linux_x64,985 ctx.h("header with bool param function", linux_x64,
986 \\export fn start(a: bool) void{_ = a;}986 \\export fn start(a: bool) void{_ = a;}
987 ,987 ,
988 \\ZIG_EXTERN_C void start(bool a0);988 \\zig_extern_c zig_void start(zig_bool const a0);
989 \\989 \\
990 );990 );
991 ctx.h("header with noreturn function", linux_x64,991 ctx.h("header with noreturn function", linux_x64,
...@@ -993,7 +993,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -993,7 +993,7 @@ pub fn addCases(ctx: *TestContext) !void {
993 \\ unreachable;993 \\ unreachable;
994 \\}994 \\}
995 ,995 ,
996 \\ZIG_EXTERN_C zig_noreturn void start(void);996 \\zig_extern_c zig_noreturn start(zig_void);
997 \\997 \\
998 );998 );
999 ctx.h("header with multiple functions", linux_x64,999 ctx.h("header with multiple functions", linux_x64,
...@@ -1001,15 +1001,15 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -1001,15 +1001,15 @@ pub fn addCases(ctx: *TestContext) !void {
1001 \\export fn b() void{}1001 \\export fn b() void{}
1002 \\export fn c() void{}1002 \\export fn c() void{}
1003 ,1003 ,
1004 \\ZIG_EXTERN_C void a(void);1004 \\zig_extern_c zig_void a(zig_void);
1005 \\ZIG_EXTERN_C void b(void);1005 \\zig_extern_c zig_void b(zig_void);
1006 \\ZIG_EXTERN_C void c(void);1006 \\zig_extern_c zig_void c(zig_void);
1007 \\1007 \\
1008 );1008 );
1009 ctx.h("header with multiple includes", linux_x64,1009 ctx.h("header with multiple includes", linux_x64,
1010 \\export fn start(a: u32, b: usize) void{ _ = a; _ = b; }1010 \\export fn start(a: u32, b: usize) void{ _ = a; _ = b; }
1011 ,1011 ,
1012 \\ZIG_EXTERN_C void start(uint32_t a0, uintptr_t a1);1012 \\zig_extern_c zig_void start(zig_u32 const a0, zig_usize const a1);
1013 \\1013 \\
1014 );1014 );
1015}1015}