Skip to content

Commit

Permalink
extra c functions in cpp.zig
Browse files Browse the repository at this point in the history
  • Loading branch information
lassade committed Jul 29, 2023
1 parent 8d2ddb4 commit 753a56e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Transpiler.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2426,7 +2426,7 @@ fn visitUnresolvedMemberExpr(self: *Self, _: *const json.Value) !void {

// todo: wut?!
log.warn("impossible to solve `UnresolvedMemberExpr`", .{});
_ = try self.out.write("@\"unresolvedMemberExpr!\"");
_ = try self.out.write("0=0=UnresolvedMemberExpr");
}

fn visitConditionalOperator(self: *Self, node: *const json.Value) !void {
Expand Down
8 changes: 6 additions & 2 deletions src/cpp.zig
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@ pub fn FlagsMixin(comptime FlagsType: type) type {
};
}

extern fn malloc(usize) ?*anyopaque;
extern fn free(?*anyopaque) void;
extern fn memset(ptr: *anyopaque, value: c_int, num: usize) *anyopaque;
extern fn memcpy(destination: *anyopaque, source: *const anyopaque, num: usize) *anyopaque;
extern fn memmove(destination: *anyopaque, source: *const anyopaque, num: usize) *anyopaque;
extern fn strcmp(str1: *const c_char, str2: *const c_char) c_int;
extern fn malloc(size: usize) ?*anyopaque;
extern fn free(ptr: ?*anyopaque) void;

/// default stateless allocator, uses `malloc` and `free` internally
pub fn Allocator(comptime T: type) type {
Expand Down

0 comments on commit 753a56e

Please sign in to comment.