authorgravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2020-06-15 23:51:25+10:00
committergravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2020-06-15 23:51:25+10:00
logaf592f0ddd4448e746cf288b674c0199325598d5
tree0f6ec3faebbe5169743ce62a6bf6eb07226ce547
parentce30357532395f46229052b5bcdc5f0a49d2b20d
signature Commit is signed but in an unrecognized format.

std: remove std.debug.getStderrStream

Rather than migrate to new 'writer' interface, just remove it

2 files changed, 7 insertions(+), 11 deletions(-)

lib/std/debug.zig+6-10
......@@ -57,14 +57,10 @@ var stderr_mutex = std.Mutex.init();
5757pub fn warn(comptime fmt: []const u8, args: var) void {
5858 const held = stderr_mutex.acquire();
5959 defer held.release();
60 const stderr = getStderrStream();
60 const stderr = io.getStdErr().writer();
6161 nosuspend stderr.print(fmt, args) catch return;
6262}
6363
64pub fn getStderrStream() File.OutStream {
65 return io.getStdErr().outStream();
66}
67
6864pub fn getStderrMutex() *std.Mutex {
6965 return &stderr_mutex;
7066}
......@@ -102,7 +98,7 @@ pub fn detectTTYConfig() TTY.Config {
10298/// TODO multithreaded awareness
10399pub fn dumpCurrentStackTrace(start_addr: ?usize) void {
104100 nosuspend {
105 const stderr = getStderrStream();
101 const stderr = io.getStdErr().writer();
106102 if (builtin.strip_debug_info) {
107103 stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return;
108104 return;
......@@ -123,7 +119,7 @@ pub fn dumpCurrentStackTrace(start_addr: ?usize) void {
123119/// TODO multithreaded awareness
124120pub fn dumpStackTraceFromBase(bp: usize, ip: usize) void {
125121 nosuspend {
126 const stderr = getStderrStream();
122 const stderr = io.getStdErr().writer();
127123 if (builtin.strip_debug_info) {
128124 stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return;
129125 return;
......@@ -193,7 +189,7 @@ pub fn captureStackTrace(first_address: ?usize, stack_trace: *builtin.StackTrace
193189/// TODO multithreaded awareness
194190pub fn dumpStackTrace(stack_trace: builtin.StackTrace) void {
195191 nosuspend {
196 const stderr = getStderrStream();
192 const stderr = io.getStdErr().writer();
197193 if (builtin.strip_debug_info) {
198194 stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return;
199195 return;
......@@ -261,7 +257,7 @@ pub fn panicExtra(trace: ?*const builtin.StackTrace, first_trace_addr: ?usize, c
261257 const held = panic_mutex.acquire();
262258 defer held.release();
263259
264 const stderr = getStderrStream();
260 const stderr = io.getStdErr().writer();
265261 stderr.print(format ++ "\n", args) catch os.abort();
266262 if (trace) |t| {
267263 dumpStackTrace(t.*);
......@@ -286,7 +282,7 @@ pub fn panicExtra(trace: ?*const builtin.StackTrace, first_trace_addr: ?usize, c
286282 // A panic happened while trying to print a previous panic message,
287283 // we're still holding the mutex but that's fine as we're going to
288284 // call abort()
289 const stderr = getStderrStream();
285 const stderr = io.getStdErr().writer();
290286 stderr.print("Panicked during a panic. Aborting.\n", .{}) catch os.abort();
291287 },
292288 else => {
lib/std/json.zig+1-1
......@@ -1288,7 +1288,7 @@ pub const Value = union(enum) {
12881288 var held = std.debug.getStderrMutex().acquire();
12891289 defer held.release();
12901290
1291 const stderr = std.debug.getStderrStream();
1291 const stderr = io.getStdErr().writer();
12921292 std.json.stringify(self, std.json.StringifyOptions{ .whitespace = null }, stderr) catch return;
12931293 }
12941294};