authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-07 13:16:36-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-07 13:17:23-07:00
log015599d1ef1606e56c49118800a4c7ef36c038e6
tree345ea153b49edb87320966c5b9d8a9732993b472
parent090834380cff9f2743f9c71e8e141ac5aceb747e

C backend: enumerate all the types in renderType

Now that we're close to supporting all the types, get rid of the `else` prong and explicitly list out those types that are not yet implemented. Thanks @g-w1

1 files changed, 19 insertions(+), 4 deletions(-)

src/codegen/c.zig+19-4
...@@ -396,6 +396,9 @@ pub const DeclGen = struct {...@@ -396,6 +396,9 @@ pub const DeclGen = struct {
396 else => unreachable,396 else => unreachable,
397 }397 }
398 },398 },
399
400 .Float => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Float", .{}),
401
399 .Pointer => {402 .Pointer => {
400 if (t.isSlice()) {403 if (t.isSlice()) {
401 return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement slices", .{});404 return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement slices", .{});
...@@ -507,10 +510,22 @@ pub const DeclGen = struct {...@@ -507,10 +510,22 @@ pub const DeclGen = struct {
507510
508 try dg.renderType(w, int_tag_ty);511 try dg.renderType(w, int_tag_ty);
509 },512 },
510 .Null, .Undefined => unreachable, // must be const or comptime513 .Union => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Union", .{}),
511 else => |e| return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type {s}", .{514 .Fn => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Fn", .{}),
512 @tagName(e),515 .Opaque => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Opaque", .{}),
513 }),516 .Frame => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Frame", .{}),
517 .AnyFrame => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type AnyFrame", .{}),
518 .Vector => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Vector", .{}),
519
520 .Null,
521 .Undefined,
522 .EnumLiteral,
523 .ComptimeFloat,
524 .ComptimeInt,
525 .Type,
526 => unreachable, // must be const or comptime
527
528 .BoundFn => unreachable, // this type will be deleted from the language
514 }529 }
515 }530 }
516531