From 985e7069a24dd84200a9c65bd43eff7809e06519 Mon Sep 17 00:00:00 2001 From: Lee Cannon Date: Wed, 15 Mar 2023 15:59:56 +0000 Subject: [PATCH] tracy: workaround zig bug (#1066) --- src/tracy.zig | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/tracy.zig b/src/tracy.zig index f933edd..09bcb0a 100644 --- a/src/tracy.zig +++ b/src/tracy.zig @@ -88,12 +88,15 @@ pub const Ctx = if (enable) ___tracy_c_zone_context else struct { pub inline fn trace(comptime src: std.builtin.SourceLocation) Ctx { if (!enable) return .{}; + // TODO: the below `.line = 1,` should be `.line = src.line`, this is blocked by + // https://github.com/ziglang/zig/issues/13315 + if (enable_callstack) { return ___tracy_emit_zone_begin_callstack(&.{ .name = null, .function = src.fn_name.ptr, .file = src.file.ptr, - .line = src.line, + .line = 1, .color = 0, }, callstack_depth, 1); } else { @@ -101,7 +104,7 @@ pub inline fn trace(comptime src: std.builtin.SourceLocation) Ctx { .name = null, .function = src.fn_name.ptr, .file = src.file.ptr, - .line = src.line, + .line = 1, .color = 0, }, 1); } @@ -110,12 +113,15 @@ pub inline fn trace(comptime src: std.builtin.SourceLocation) Ctx { pub inline fn traceNamed(comptime src: std.builtin.SourceLocation, comptime name: [:0]const u8) Ctx { if (!enable) return .{}; + // TODO: the below `.line = 1,` should be `.line = src.line`, this is blocked by + // https://github.com/ziglang/zig/issues/13315 + if (enable_callstack) { return ___tracy_emit_zone_begin_callstack(&.{ .name = name.ptr, .function = src.fn_name.ptr, .file = src.file.ptr, - .line = src.line, + .line = 1, .color = 0, }, callstack_depth, 1); } else { @@ -123,7 +129,7 @@ pub inline fn traceNamed(comptime src: std.builtin.SourceLocation, comptime name .name = name.ptr, .function = src.fn_name.ptr, .file = src.file.ptr, - .line = src.line, + .line = 1, .color = 0, }, 1); }