3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-11 19:53:35 +00:00

log: add log_deprecated

This commit is contained in:
Emil J. Tywoniak 2024-10-03 12:14:12 +02:00
parent 566dcf1878
commit 9beb4bfddd
4 changed files with 16 additions and 2 deletions

View file

@ -273,7 +273,7 @@ int main(int argc, char **argv)
("hash-seed", "mix up hashing values with <seed>, for extreme optimization and testing",
cxxopts::value<uint64_t>(), "<seed>")
("A,abort", "will call abort() at the end of the script. for debugging")
("x,experimental", "do not print warnings for the experimental <feature>",
("x,experimental", "do not print warnings for the experimental or deprecated <feature>",
cxxopts::value<std::vector<std::string>>(), "<feature>")
("g,debug", "globally enable debug log messages")
("perffile", "write a JSON performance log to <perffile>", cxxopts::value<std::string>(), "<perffile>")

View file

@ -437,6 +437,19 @@ void log_experimental(const char *format, ...)
}
}
void log_deprecated(const char *format, ...)
{
va_list ap;
va_start(ap, format);
string s = vstringf(format, ap);
va_end(ap);
if (log_experimentals_ignored.count(s) == 0 && log_experimentals.count(s) == 0) {
log_warning("Feature '%s' is deprecated.\n", s.c_str());
log_experimentals.insert(s);
}
}
void log_warning_noprefix(const char *format, ...)
{
va_list ap;

View file

@ -130,6 +130,7 @@ void log(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
void log_header(RTLIL::Design *design, const char *format, ...) YS_ATTRIBUTE(format(printf, 2, 3));
void log_warning(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
void log_experimental(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
void log_deprecated(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
void set_verific_logging(void (*cb)(int msg_type, const char *message_id, const char* file_path, unsigned int left_line, unsigned int left_col, unsigned int right_line, unsigned int right_col, const char *msg));
extern void (*log_verific_callback)(int msg_type, const char *message_id, const char* file_path, unsigned int left_line, unsigned int left_col, unsigned int right_line, unsigned int right_col, const char *msg);

View file

@ -145,7 +145,7 @@ struct LoggerPass : public Pass {
}
if (args[argidx] == "-experimental" && argidx+1 < args.size()) {
std::string value = args[++argidx];
log("Added '%s' experimental ignore list.\n", value.c_str());
log("Added '%s' experimental/deprecated ignore list.\n", value.c_str());
log_experimentals_ignored.insert(value);
continue;
}