provide default implementation of std.log on freestanding

closes #6252
master
Andrew Kelley 2020-09-04 13:00:10 -07:00
parent 0c43b6ef5c
commit 209a3da4f7
1 changed files with 4 additions and 0 deletions

View File

@ -127,6 +127,10 @@ fn log(
if (@enumToInt(message_level) <= @enumToInt(level)) {
if (@hasDecl(root, "log")) {
root.log(message_level, scope, format, args);
} else if (std.Target.current.os.tag == .freestanding) {
// On freestanding one must provide a log function; we do not have
// any I/O configured.
return;
} else if (builtin.mode != .ReleaseSmall) {
const held = std.debug.getStderrMutex().acquire();
defer held.release();