From 6a93ba9a30f431d4131a6f7494755034d9088155 Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 8 Feb 2023 15:57:57 +0100 Subject: [PATCH] zig: switch from stage1 to the new stage2 compiler stage2 has been merged and set as default around end of aug 2022 in https://github.com/ziglang/zig/pull/12368. since then the main focus has been on this new stage2 compiler. with the release of 0.10.1 the stage2 is fairly useable now and it is the way forward, towards zig 0.11 or 1.0. read more about difference in https://github.com/ziglang/zig/wiki/Self-Hosted-Compiler-Upgrade-Guide another good read on the relevant topic is https://ziglang.org/news/goodbye-cpp/ --- build.zig | 2 -- src/ngui.zig | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/build.zig b/build.zig index b8be1ce..b974c20 100644 --- a/build.zig +++ b/build.zig @@ -2,8 +2,6 @@ const std = @import("std"); const nifbuild = @import("lib/nif/build.zig"); pub fn build(b: *std.build.Builder) void { - b.use_stage1 = true; - const target = b.standardTargetOptions(.{}); const mode = b.standardReleaseOptions(); const strip = b.option(bool, "strip", "strip output binary; default: false") orelse false; diff --git a/src/ngui.zig b/src/ngui.zig index a466b29..7e90a96 100644 --- a/src/ngui.zig +++ b/src/ngui.zig @@ -19,10 +19,9 @@ const logger = std.log.scoped(.ngui); const lvgl_logger = std.log.scoped(.lvgl); // logs LV_LOG_xxx messages extern "c" fn lv_timer_handler() u32; -extern "c" fn lv_log_register_print_cb(fn (msg: [*:0]const u8) callconv(.C) void) void; +extern "c" fn lv_log_register_print_cb(*const fn (msg: [*:0]const u8) callconv(.C) void) void; const LvTimer = opaque {}; -//const LvTimerCallback = *const fn (timer: *LvTimer) callconv(.C) void; // stage2 -const LvTimerCallback = fn (timer: *LvTimer) callconv(.C) void; +const LvTimerCallback = *const fn (timer: *LvTimer) callconv(.C) void; extern "c" fn lv_timer_create(callback: LvTimerCallback, period_ms: u32, userdata: ?*anyopaque) *LvTimer; extern "c" fn lv_timer_del(timer: *LvTimer) void; extern "c" fn lv_timer_set_repeat_count(timer: *LvTimer, n: i32) void;