mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-12 20:18:20 +00:00
Improve handling of warning messages
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
parent
2935e8ea41
commit
e5534a080e
|
@ -480,6 +480,8 @@ int main(int argc, char **argv)
|
||||||
if (mode_v && !mode_q)
|
if (mode_v && !mode_q)
|
||||||
log_files.push_back(stderr);
|
log_files.push_back(stderr);
|
||||||
|
|
||||||
|
if (log_warnings_count)
|
||||||
|
log("Warnings: %d unique messages, %d total\n", GetSize(log_warnings), log_warnings_count);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
log("End of script. Logfile hash: %s\n", hash.c_str());
|
log("End of script. Logfile hash: %s\n", hash.c_str());
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -42,6 +42,8 @@ std::vector<FILE*> log_files;
|
||||||
std::vector<std::ostream*> log_streams;
|
std::vector<std::ostream*> log_streams;
|
||||||
std::map<std::string, std::set<std::string>> log_hdump;
|
std::map<std::string, std::set<std::string>> log_hdump;
|
||||||
std::vector<std::regex> log_warn_regexes, log_nowarn_regexes;
|
std::vector<std::regex> log_warn_regexes, log_nowarn_regexes;
|
||||||
|
std::set<std::string> log_warnings;
|
||||||
|
int log_warnings_count = 0;
|
||||||
bool log_hdump_all = false;
|
bool log_hdump_all = false;
|
||||||
FILE *log_errfile = NULL;
|
FILE *log_errfile = NULL;
|
||||||
SHA1 *log_hasher = NULL;
|
SHA1 *log_hasher = NULL;
|
||||||
|
@ -216,14 +218,26 @@ void logv_warning(const char *format, va_list ap)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (log_errfile != NULL && !log_quiet_warnings)
|
if (log_warnings.count(message))
|
||||||
log_files.push_back(log_errfile);
|
{
|
||||||
|
log("Warning: %s", message.c_str());
|
||||||
|
log_flush();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (log_errfile != NULL && !log_quiet_warnings)
|
||||||
|
log_files.push_back(log_errfile);
|
||||||
|
|
||||||
log("Warning: %s", message.c_str());
|
log("Warning: %s", message.c_str());
|
||||||
log_flush();
|
log_flush();
|
||||||
|
|
||||||
if (log_errfile != NULL && !log_quiet_warnings)
|
if (log_errfile != NULL && !log_quiet_warnings)
|
||||||
log_files.pop_back();
|
log_files.pop_back();
|
||||||
|
|
||||||
|
log_warnings.insert(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
log_warnings_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,14 +256,26 @@ void logv_warning_noprefix(const char *format, va_list ap)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (log_errfile != NULL && !log_quiet_warnings)
|
if (log_warnings.count(message))
|
||||||
log_files.push_back(log_errfile);
|
{
|
||||||
|
log("%s", message.c_str());
|
||||||
|
log_flush();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (log_errfile != NULL && !log_quiet_warnings)
|
||||||
|
log_files.push_back(log_errfile);
|
||||||
|
|
||||||
log("%s", message.c_str());
|
log("%s", message.c_str());
|
||||||
log_flush();
|
log_flush();
|
||||||
|
|
||||||
if (log_errfile != NULL && !log_quiet_warnings)
|
if (log_errfile != NULL && !log_quiet_warnings)
|
||||||
log_files.pop_back();
|
log_files.pop_back();
|
||||||
|
|
||||||
|
log_warnings.insert(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
log_warnings_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,8 @@ extern std::vector<FILE*> log_files;
|
||||||
extern std::vector<std::ostream*> log_streams;
|
extern std::vector<std::ostream*> log_streams;
|
||||||
extern std::map<std::string, std::set<std::string>> log_hdump;
|
extern std::map<std::string, std::set<std::string>> log_hdump;
|
||||||
extern std::vector<std::regex> log_warn_regexes, log_nowarn_regexes;
|
extern std::vector<std::regex> log_warn_regexes, log_nowarn_regexes;
|
||||||
|
extern std::set<std::string> log_warnings;
|
||||||
|
extern int log_warnings_count;
|
||||||
extern bool log_hdump_all;
|
extern bool log_hdump_all;
|
||||||
extern FILE *log_errfile;
|
extern FILE *log_errfile;
|
||||||
extern SHA1 *log_hasher;
|
extern SHA1 *log_hasher;
|
||||||
|
|
Loading…
Reference in a new issue