Improve logging use of experimental features
authorClaire Wolf <clifford@clifford.at>
Tue, 28 Jan 2020 16:51:50 +0000 (17:51 +0100)
committerClaire Wolf <clifford@clifford.at>
Tue, 28 Jan 2020 16:51:50 +0000 (17:51 +0100)
Signed-off-by: Claire Wolf <clifford@clifford.at>
kernel/driver.cc
kernel/log.cc
kernel/log.h

index acbf6b55d5d344d0142db93ed18347de6ce81a80..9040408bc0dc58c71b282b7f666908be611c54e2 100644 (file)
@@ -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
index 0ecf59c3300a8c13e389ce9f55c52a2918cfc789..f5d6c488e0923db62e28c4b279f9232bc3e808b6 100644 (file)
@@ -42,7 +42,7 @@ std::vector<FILE*> log_files;
 std::vector<std::ostream*> log_streams;
 std::map<std::string, std::set<std::string>> log_hdump;
 std::vector<std::regex> log_warn_regexes, log_nowarn_regexes, log_werror_regexes;
-std::set<std::string> log_warnings, log_experimentals;
+std::set<std::string> 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);
        }
index be70f4d9da98f143c0670c499a4abf74f3b1e265..9db8efaa5eaa4cad2742e7cfa7cde7133b2d41c6 100644 (file)
@@ -50,7 +50,7 @@ extern std::vector<FILE*> log_files;
 extern std::vector<std::ostream*> log_streams;
 extern std::map<std::string, std::set<std::string>> log_hdump;
 extern std::vector<std::regex> log_warn_regexes, log_nowarn_regexes, log_werror_regexes;
-extern std::set<std::string> log_warnings, log_experimentals;
+extern std::set<std::string> log_warnings, log_experimentals, log_experimentals_ignored;
 extern int log_warnings_count;
 extern bool log_hdump_all;
 extern FILE *log_errfile;