From 9beb4bfddd8c7f664bffd1bfc7b48bc2320f748a Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Thu, 3 Oct 2024 12:14:12 +0200 Subject: [PATCH] log: add log_deprecated --- kernel/driver.cc | 2 +- kernel/log.cc | 13 +++++++++++++ kernel/log.h | 1 + passes/cmds/logger.cc | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/kernel/driver.cc b/kernel/driver.cc index cbbf7ce68..8c0bdf659 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -273,7 +273,7 @@ int main(int argc, char **argv) ("hash-seed", "mix up hashing values with , for extreme optimization and testing", cxxopts::value(), "") ("A,abort", "will call abort() at the end of the script. for debugging") - ("x,experimental", "do not print warnings for the experimental ", + ("x,experimental", "do not print warnings for the experimental or deprecated ", cxxopts::value>(), "") ("g,debug", "globally enable debug log messages") ("perffile", "write a JSON performance log to ", cxxopts::value(), "") diff --git a/kernel/log.cc b/kernel/log.cc index 55895da06..6d84e478d 100644 --- a/kernel/log.cc +++ b/kernel/log.cc @@ -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; diff --git a/kernel/log.h b/kernel/log.h index e26ef072c..e046dce69 100644 --- a/kernel/log.h +++ b/kernel/log.h @@ -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); diff --git a/passes/cmds/logger.cc b/passes/cmds/logger.cc index 9e45e86af..c5b23cf7b 100644 --- a/passes/cmds/logger.cc +++ b/passes/cmds/logger.cc @@ -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; }