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 {
12301230 try fwd_decl_writer.writeAll("zig_threadlocal ");
12311231 }
12321232
1233 const decl_c_value: CValue = if (is_global) .{ .bytes = mem.span(o.dg.decl.name) }
1234 else .{ .decl = o.dg.decl };
1233 const decl_c_value: CValue = if (is_global) .{ .bytes = mem.span(o.dg.decl.name) } else .{ .decl = o.dg.decl };
12351234
12361235 try o.dg.renderTypeAndName(fwd_decl_writer, o.dg.decl.ty, decl_c_value, .Mut, o.dg.decl.align_val);
12371236 try fwd_decl_writer.writeAll(";\n");
......@@ -2770,7 +2769,7 @@ fn structFieldPtr(f: *Function, inst: Air.Inst.Index, struct_ptr_ty: Type, struc
27702769 const writer = f.object.writer();
27712770 const struct_ty = struct_ptr_ty.elemType();
27722771 var field_name: []const u8 = undefined;
2773 var field_val_ty: Type = undefined;
2772 var field_val_ty: Type = undefined;
27742773
27752774 switch (struct_ty.tag()) {
27762775 .@"struct" => {
......@@ -3167,7 +3166,7 @@ fn airSetUnionTag(f: *Function, inst: Air.Inst.Index) !CValue {
31673166 const union_ty = f.air.typeOf(bin_op.lhs).childType();
31683167 const target = f.object.dg.module.getTarget();
31693168 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
31723171 try f.writeCValue(writer, union_ptr);
31733172 try writer.writeAll("->tag = ");
......@@ -3190,7 +3189,7 @@ fn airGetUnionTag(f: *Function, inst: Air.Inst.Index) !CValue {
31903189
31913190 const target = f.object.dg.module.getTarget();
31923191 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
31953194 try writer.writeAll(" = ");
31963195 try f.writeCValue(writer, operand);
test/behavior.zig+1-1
......@@ -67,7 +67,7 @@ test {
6767 // Tests that pass for stage1, llvm backend, C backend
6868 _ = @import("behavior/cast_int.zig");
6969 _ = @import("behavior/int128.zig");
70 _ = @import("behavior/union.zig");
70 _ = @import("behavior/union.zig");
7171 _ = @import("behavior/translate_c_macros.zig");
7272
7373 if (builtin.zig_backend != .stage2_c) {