3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-08-04 10:20:24 +00:00

Make log() use the FmtString infrastructure.

Now `log()` supports `std::string`.

We have to fix a few places where the format parameter was not a compile time constant.
This is mostly trivial.
This commit is contained in:
Robert O'Callahan 2025-07-10 05:24:59 +00:00
parent 422ec05322
commit 2e28feed94
9 changed files with 67 additions and 38 deletions

View file

@ -97,13 +97,13 @@ struct LogPass : public Pass {
text += args[argidx] + ' ';
if (!text.empty()) text.resize(text.size()-1);
const char *fmtline = newline ? "%s\n" : "%s";
const char *line_end = newline ? "\n" : "";
if (to_stdout) fprintf(stdout, fmtline, text.c_str());
if (to_stderr) fprintf(stderr, fmtline, text.c_str());
if (to_stdout) fprintf(stdout, "%s%s", text.c_str(), line_end);
if (to_stderr) fprintf(stderr, "%s%s", text.c_str(), line_end);
if (to_log) {
if (!header) log(fmtline, text.c_str());
else log_header(design, fmtline, text.c_str());
if (!header) log("%s%s", text.c_str(), line_end);
else log_header(design, "%s%s", text.c_str(), line_end);
}
}
} LogPass;