log: log_deprecated takes a version parameter

This commit is contained in:
Emil J. Tywoniak
2026-10-02 15:52:13 +02:00
parent 0fa1478ce8
commit 082dd235b7
3 changed files with 18 additions and 11 deletions
+5 -2
View File
@@ -708,8 +708,11 @@ int main(int argc, char **argv)
if (GetSize(logger().get_deprecated()) != 0) {
log("Deprecated features used:\n");
for(auto &feature : logger().get_deprecated())
log(" %s\n", feature);
for (auto &[feature, earliest_removal] : logger().get_deprecated())
if (earliest_removal.empty())
log(" %s\n", feature);
else
log(" %s (may be removed as soon as Yosys %s)\n", feature, earliest_removal);
}
#ifdef _WIN32
log("End of script. Logfile hash: %s\n", hash);
+7 -4
View File
@@ -404,11 +404,14 @@ void LogManager::add_experimental(const std::string &str)
}
}
void LogManager::add_deprecated(const std::string &str)
void LogManager::add_deprecated(const std::string &feature, const std::string &earliest_removal)
{
if (deprecated.count(str) == 0) {
log_warning("Feature '%s' is deprecated.\n", str);
deprecated.insert(str);
if (deprecated.count(feature) == 0) {
if (earliest_removal.empty())
log_warning("Feature '%s' is deprecated.\n", feature);
else
log_warning("Feature '%s' is deprecated and may be removed as soon as Yosys %s.\n", feature, earliest_removal);
deprecated[feature] = earliest_removal;
}
}
+6 -5
View File
@@ -394,7 +394,7 @@ public:
int get_warnings_total() const { return warnings_count; }
int get_errors_total() const { return errors_count; }
const std::set<std::string> &get_experimental() const { return experimental; }
const std::set<std::string> &get_deprecated() const { return deprecated; }
const std::map<std::string, std::string> &get_deprecated() const { return deprecated; }
std::chrono::steady_clock::time_point get_initial_time() const;
void add_hdump(std::string name, std::string value) { hdump[name].insert(value); }
@@ -409,7 +409,7 @@ public:
[[noreturn]] void formatted_cmd_error(std::string_view format, std::string message);
void suppressed();
void add_experimental(const std::string &str);
void add_deprecated(const std::string &str);
void add_deprecated(const std::string &feature, const std::string &earliest_removal);
void spacer();
void push();
void pop();
@@ -437,7 +437,8 @@ private:
int errors_count = 0;
int warnings_count = 0;
int warnings_count_noexpect = 0;
std::set<std::string> warnings, experimental, experimental_ignored, deprecated;
std::set<std::string> warnings, experimental, experimental_ignored;
std::map<std::string, std::string> deprecated;
std::vector<std::regex> warn_regexes, nowarn_regexes, werror_regexes;
dict<std::string, LogExpectedItem> expect_log, expect_warning, expect_error;
@@ -511,9 +512,9 @@ inline void log_experimental(const std::string &str)
logger().add_experimental(str);
}
inline void log_deprecated(const std::string &str)
inline void log_deprecated(const std::string &feature, const std::string &earliest_removal = "")
{
logger().add_deprecated(str);
logger().add_deprecated(feature, earliest_removal);
}
// Log with filename to report a problem in a source file.