mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
std.debug.Trace: follow the struct default field guidance
This commit is contained in:
parent
a486392ee4
commit
1cf1cb6ae0
@ -2759,13 +2759,19 @@ pub const Trace = ConfigurableTrace(2, 4, builtin.mode == .Debug);
|
||||
|
||||
pub fn ConfigurableTrace(comptime size: usize, comptime stack_frame_count: usize, comptime is_enabled: bool) type {
|
||||
return struct {
|
||||
addrs: [actual_size][stack_frame_count]usize = undefined,
|
||||
notes: [actual_size][]const u8 = undefined,
|
||||
index: Index = 0,
|
||||
addrs: [actual_size][stack_frame_count]usize,
|
||||
notes: [actual_size][]const u8,
|
||||
index: Index,
|
||||
|
||||
const actual_size = if (enabled) size else 0;
|
||||
const Index = if (enabled) usize else u0;
|
||||
|
||||
pub const init: @This() = .{
|
||||
.addrs = undefined,
|
||||
.notes = undefined,
|
||||
.index = 0,
|
||||
};
|
||||
|
||||
pub const enabled = is_enabled;
|
||||
|
||||
pub const add = if (enabled) addNoInline else addNoOp;
|
||||
|
||||
@ -718,7 +718,7 @@ pub const LazySrcLoc = union(enum) {
|
||||
/// where in semantic analysis the value got set.
|
||||
pub const TracedOffset = struct {
|
||||
x: i32,
|
||||
trace: std.debug.Trace = .{},
|
||||
trace: std.debug.Trace = std.debug.Trace.init,
|
||||
|
||||
const want_tracing = false;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user