From 7d042521260b285770e77ff2e5914ca5b8c43685 Mon Sep 17 00:00:00 2001 From: Beau McCartney <63375392+BeauSLM@users.noreply.github.com> Date: Sun, 25 Dec 2022 13:37:23 -0700 Subject: [PATCH] mach: remove compiler error for missing field in app (upstream issue fixed) (#647) * platform: allow fieldless App * platform: remove unused field Co-authored-by: Beau McCartney --- src/platform/common.zig | 13 ++----------- src/platform/libmach.zig | 3 --- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/platform/common.zig b/src/platform/common.zig index 2dfadedf..62ed49ac 100644 --- a/src/platform/common.zig +++ b/src/platform/common.zig @@ -6,17 +6,8 @@ pub fn checkApplication(comptime app_pkg: type) void { } const App = app_pkg.App; - // If App has no fields, it gets interpretted as '*const App' when it should be '*App' - // This gives a more useful compiler error. - switch (@typeInfo(App)) { - .Struct => |app| { - if (app.fields.len == 0) { - @compileError("App must contain fields. Example: '_unused: i32,'"); - } - }, - else => { - @compileError("App must be a struct type. Found:" ++ @typeName(App)); - }, + if (@typeInfo(App) != .Struct) { + @compileError("App must be a struct type. Found:" ++ @typeName(App)); } if (@hasDecl(App, "init")) { diff --git a/src/platform/libmach.zig b/src/platform/libmach.zig index a128f1ea..478b96c6 100644 --- a/src/platform/libmach.zig +++ b/src/platform/libmach.zig @@ -7,9 +7,6 @@ const native = @import("native.zig"); pub const App = @This(); -// TODO(self-hosted): https://github.com/ziglang/zig/issues/12275 -_unused: i32, - pub const GPUInterface = gpu.dawn.Interface; const _ = gpu.Export(GPUInterface);