From 5c2508cef82d86cebff3d008962fde6a0e49d10e Mon Sep 17 00:00:00 2001 From: Claire Wolf Date: Tue, 28 Jan 2020 17:51:50 +0100 Subject: [PATCH] Improve logging use of experimental features Signed-off-by: Claire Wolf --- kernel/driver.cc | 6 +++++- kernel/log.cc | 4 ++-- kernel/log.h | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/kernel/driver.cc b/kernel/driver.cc index acbf6b55d..9040408bc 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -459,7 +459,7 @@ int main(int argc, char **argv) depsfile = optarg; break; case 'x': - log_experimentals.insert(optarg); + log_experimentals_ignored.insert(optarg); break; default: fprintf(stderr, "Run '%s -h' for help.\n", argv[0]); @@ -573,6 +573,10 @@ int main(int argc, char **argv) if (log_warnings_count) log("Warnings: %d unique messages, %d total\n", GetSize(log_warnings), log_warnings_count); + + if (!log_experimentals.empty()) + log("Warnings: %d experimental features used (not excluded with -x).\n", GetSize(log_experimentals)); + #ifdef _WIN32 log("End of script. Logfile hash: %s\n", hash.c_str()); #else diff --git a/kernel/log.cc b/kernel/log.cc index 0ecf59c33..f5d6c488e 100644 --- a/kernel/log.cc +++ b/kernel/log.cc @@ -42,7 +42,7 @@ std::vector log_files; std::vector log_streams; std::map> log_hdump; std::vector log_warn_regexes, log_nowarn_regexes, log_werror_regexes; -std::set log_warnings, log_experimentals; +std::set log_warnings, log_experimentals, log_experimentals_ignored; int log_warnings_count = 0; bool log_hdump_all = false; FILE *log_errfile = NULL; @@ -384,7 +384,7 @@ void log_experimental(const char *format, ...) string s = vstringf(format, ap); va_end(ap); - if (log_experimentals.count(s) == 0) { + if (log_experimentals_ignored.count(s) == 0 && log_experimentals.count(s) == 0) { log_warning("Feature '%s' is experimental.\n", s.c_str()); log_experimentals.insert(s); } diff --git a/kernel/log.h b/kernel/log.h index be70f4d9d..9db8efaa5 100644 --- a/kernel/log.h +++ b/kernel/log.h @@ -50,7 +50,7 @@ extern std::vector log_files; extern std::vector log_streams; extern std::map> log_hdump; extern std::vector log_warn_regexes, log_nowarn_regexes, log_werror_regexes; -extern std::set log_warnings, log_experimentals; +extern std::set log_warnings, log_experimentals, log_experimentals_ignored; extern int log_warnings_count; extern bool log_hdump_all; extern FILE *log_errfile; -- 2.30.2