aboutsummaryrefslogtreecommitdiff
path: root/lib/std/builtin.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-11-19 19:15:14 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-11-19 19:15:14 -0700
commite24dcd2707b5956cd53d4b38dc3ac6be0cf0a264 (patch)
tree8ea6a97af42a4f2b806a4eae6c34c5cabb7c0fbc /lib/std/builtin.zig
parent696e51be4971631b05bd9eda52e36c7be3a83342 (diff)
downloadzig-e24dcd2707b5956cd53d4b38dc3ac6be0cf0a264.tar.gz
zig-e24dcd2707b5956cd53d4b38dc3ac6be0cf0a264.zip
std.builtin.StackTrace: format() workaround on freestanding
This whole thing needs to be reworked but for now at least don't cause a compile error when building for a target that doesn't have stderr or detectTTYConfig.
Diffstat (limited to 'lib/std/builtin.zig')
-rw-r--r--lib/std/builtin.zig5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig
index 289e1dee0d..3eed87345b 100644
--- a/lib/std/builtin.zig
+++ b/lib/std/builtin.zig
@@ -61,6 +61,11 @@ pub const StackTrace = struct {
options: std.fmt.FormatOptions,
writer: anytype,
) !void {
+ // TODO: re-evaluate whether to use format() methods at all.
+ // Until then, avoid an error when using GeneralPurposeAllocator with WebAssembly
+ // where it tries to call detectTTYConfig here.
+ if (builtin.os.tag == .freestanding) return;
+
_ = fmt;
_ = options;
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);