mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
CBE: add support for bool,u32
This commit is contained in:
parent
15a148db01
commit
37438dd789
@ -26,15 +26,19 @@ fn renderType(ctx: *Context, header: *C.Header, writer: std.ArrayList(u8).Writer
|
||||
try writer.writeAll("zig_noreturn void");
|
||||
},
|
||||
.Void => try writer.writeAll("void"),
|
||||
.Bool => try writer.writeAll("bool"),
|
||||
.Int => {
|
||||
if (T.tag() == .u8) {
|
||||
header.need_stdint = true;
|
||||
try writer.writeAll("uint8_t");
|
||||
} else if (T.tag() == .u32) {
|
||||
header.need_stdint = true;
|
||||
try writer.writeAll("uint32_t");
|
||||
} else if (T.tag() == .usize) {
|
||||
header.need_stddef = true;
|
||||
try writer.writeAll("size_t");
|
||||
} else {
|
||||
return ctx.fail(ctx.decl.src(), "TODO implement int types", .{});
|
||||
return ctx.fail(ctx.decl.src(), "TODO implement int type {}", .{T});
|
||||
}
|
||||
},
|
||||
else => |e| return ctx.fail(ctx.decl.src(), "TODO implement type {}", .{e}),
|
||||
|
||||
@ -1,3 +1,12 @@
|
||||
#if __STDC_VERSION__ >= 199901L
|
||||
// C99 or newer
|
||||
#include <stdbool.h>
|
||||
#else
|
||||
#define bool unsigned char
|
||||
#define true 1
|
||||
#define false 0
|
||||
#endif
|
||||
|
||||
#if __STDC_VERSION__ >= 201112L
|
||||
#define zig_noreturn _Noreturn
|
||||
#elif __GNUC__
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user