authorgravatar for cody+topolarity@tapscott.meCody Tapscott <cody+topolarity@tapscott.me> 2022-01-24 12:18:16-07:00
committergravatar for cody+topolarity@tapscott.meCody Tapscott <cody+topolarity@tapscott.me> 2022-01-24 12:18:16-07:00
logcb24799368c3b944f18aae3c030a070038f3de9b
treefd0ec1f055270cbcd7dc898ccc7688353d0d5343
parent587a4437dbe4518671f4a894edb7d0f8e51d2ee1

Run `zig fmt`


2 files changed, 5 insertions(+), 6 deletions(-)

src/codegen/c.zig+4-5
...@@ -1230,8 +1230,7 @@ pub fn genDecl(o: *Object) !void {...@@ -1230,8 +1230,7 @@ pub fn genDecl(o: *Object) !void {
1230 try fwd_decl_writer.writeAll("zig_threadlocal ");1230 try fwd_decl_writer.writeAll("zig_threadlocal ");
1231 }1231 }
12321232
1233 const decl_c_value: CValue = if (is_global) .{ .bytes = mem.span(o.dg.decl.name) }1233 const decl_c_value: CValue = if (is_global) .{ .bytes = mem.span(o.dg.decl.name) } else .{ .decl = o.dg.decl };
1234 else .{ .decl = o.dg.decl };
12351234
1236 try o.dg.renderTypeAndName(fwd_decl_writer, o.dg.decl.ty, decl_c_value, .Mut, o.dg.decl.align_val);1235 try o.dg.renderTypeAndName(fwd_decl_writer, o.dg.decl.ty, decl_c_value, .Mut, o.dg.decl.align_val);
1237 try fwd_decl_writer.writeAll(";\n");1236 try fwd_decl_writer.writeAll(";\n");
...@@ -2770,7 +2769,7 @@ fn structFieldPtr(f: *Function, inst: Air.Inst.Index, struct_ptr_ty: Type, struc...@@ -2770,7 +2769,7 @@ fn structFieldPtr(f: *Function, inst: Air.Inst.Index, struct_ptr_ty: Type, struc
2770 const writer = f.object.writer();2769 const writer = f.object.writer();
2771 const struct_ty = struct_ptr_ty.elemType();2770 const struct_ty = struct_ptr_ty.elemType();
2772 var field_name: []const u8 = undefined;2771 var field_name: []const u8 = undefined;
2773 var field_val_ty: Type = undefined; 2772 var field_val_ty: Type = undefined;
27742773
2775 switch (struct_ty.tag()) {2774 switch (struct_ty.tag()) {
2776 .@"struct" => {2775 .@"struct" => {
...@@ -3167,7 +3166,7 @@ fn airSetUnionTag(f: *Function, inst: Air.Inst.Index) !CValue {...@@ -3167,7 +3166,7 @@ fn airSetUnionTag(f: *Function, inst: Air.Inst.Index) !CValue {
3167 const union_ty = f.air.typeOf(bin_op.lhs).childType();3166 const union_ty = f.air.typeOf(bin_op.lhs).childType();
3168 const target = f.object.dg.module.getTarget();3167 const target = f.object.dg.module.getTarget();
3169 const layout = union_ty.unionGetLayout(target);3168 const layout = union_ty.unionGetLayout(target);
3170 if (layout.tag_size == 0) return CValue.none;3169 if (layout.tag_size == 0) return CValue.none;
31713170
3172 try f.writeCValue(writer, union_ptr);3171 try f.writeCValue(writer, union_ptr);
3173 try writer.writeAll("->tag = ");3172 try writer.writeAll("->tag = ");
...@@ -3190,7 +3189,7 @@ fn airGetUnionTag(f: *Function, inst: Air.Inst.Index) !CValue {...@@ -3190,7 +3189,7 @@ fn airGetUnionTag(f: *Function, inst: Air.Inst.Index) !CValue {
31903189
3191 const target = f.object.dg.module.getTarget();3190 const target = f.object.dg.module.getTarget();
3192 const layout = un_ty.unionGetLayout(target);3191 const layout = un_ty.unionGetLayout(target);
3193 if (layout.tag_size == 0) return CValue.none;3192 if (layout.tag_size == 0) return CValue.none;
31943193
3195 try writer.writeAll(" = ");3194 try writer.writeAll(" = ");
3196 try f.writeCValue(writer, operand);3195 try f.writeCValue(writer, operand);
test/behavior.zig+1-1
...@@ -67,7 +67,7 @@ test {...@@ -67,7 +67,7 @@ test {
67 // Tests that pass for stage1, llvm backend, C backend67 // Tests that pass for stage1, llvm backend, C backend
68 _ = @import("behavior/cast_int.zig");68 _ = @import("behavior/cast_int.zig");
69 _ = @import("behavior/int128.zig");69 _ = @import("behavior/int128.zig");
70 _ = @import("behavior/union.zig");70 _ = @import("behavior/union.zig");
71 _ = @import("behavior/translate_c_macros.zig");71 _ = @import("behavior/translate_c_macros.zig");
7272
73 if (builtin.zig_backend != .stage2_c) {73 if (builtin.zig_backend != .stage2_c) {