mirror of
https://github.com/ziglang/zig.git
synced 2025-12-21 21:53:08 +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 {
|
pub fn ConfigurableTrace(comptime size: usize, comptime stack_frame_count: usize, comptime is_enabled: bool) type {
|
||||||
return struct {
|
return struct {
|
||||||
addrs: [actual_size][stack_frame_count]usize = undefined,
|
addrs: [actual_size][stack_frame_count]usize,
|
||||||
notes: [actual_size][]const u8 = undefined,
|
notes: [actual_size][]const u8,
|
||||||
index: Index = 0,
|
index: Index,
|
||||||
|
|
||||||
const actual_size = if (enabled) size else 0;
|
const actual_size = if (enabled) size else 0;
|
||||||
const Index = if (enabled) usize else u0;
|
const Index = if (enabled) usize else u0;
|
||||||
|
|
||||||
|
pub const init: @This() = .{
|
||||||
|
.addrs = undefined,
|
||||||
|
.notes = undefined,
|
||||||
|
.index = 0,
|
||||||
|
};
|
||||||
|
|
||||||
pub const enabled = is_enabled;
|
pub const enabled = is_enabled;
|
||||||
|
|
||||||
pub const add = if (enabled) addNoInline else addNoOp;
|
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.
|
/// where in semantic analysis the value got set.
|
||||||
pub const TracedOffset = struct {
|
pub const TracedOffset = struct {
|
||||||
x: i32,
|
x: i32,
|
||||||
trace: std.debug.Trace = .{},
|
trace: std.debug.Trace = std.debug.Trace.init,
|
||||||
|
|
||||||
const want_tracing = false;
|
const want_tracing = false;
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user