From c8eb950ca0aeb52dab31bf729bb7f39e47e0a0fd Mon Sep 17 00:00:00 2001 From: "Aleksei (Faumaray) Selikhov" Date: Sun, 6 Dec 2026 08:26:51 +0300 Subject: [PATCH] feat: surface compiler warnings from every build path Factor the warning output into print_action_warnings and use it for the build/test loop and vbs install; the daemon build logs the stderr of successful actions as well. --- src/Daemon/Daemon.cpp | 3 +++ src/Main.cpp | 25 +++++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp index c4b2bd3..b773d58 100644 --- a/src/Daemon/Daemon.cpp +++ b/src/Daemon/Daemon.cpp @@ -795,6 +795,9 @@ Void::Result::Result execute_project_build( failure.emplace("target", JsonValue{result.target_name}); failure.emplace("error", JsonValue{result.error_message}); outcome.failed_actions.emplace_back(std::move(failure)); + } else if (!result.from_cache && !result.stderr_data.empty()) { + // Do not drop compiler warnings from successful actions. + Void::Log::warn("Daemon", "{}", result.stderr_data); } } diff --git a/src/Main.cpp b/src/Main.cpp index b9b6186..ee94be2 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -81,6 +81,19 @@ namespace { using namespace Void::Build; +// Prints the compiler warnings/notes captured from actions that succeeded. +// Only failures used to print their stderr, hiding warnings entirely. +void print_action_warnings(const Execution::ExecutionReport &report) { + for (const auto &result : report.results) { + if (result.succeeded && !result.from_cache && !result.stderr_data.empty()) { + std::cerr << result.stderr_data; + if (result.stderr_data.back() != '\n') { + std::cerr << '\n'; + } + } + } +} + // ANSI colors are enabled only for a terminal and are disabled by NO_COLOR or --no-color. bool g_no_color = false; @@ -789,16 +802,7 @@ int execute_build_or_test(BuildCmdOptions opts, bool run_tests) { all_ok = false; continue; } - // Surface compiler warnings and notes from actions that succeeded: only - // failures used to print their captured stderr, hiding warnings entirely. - for (const auto &ar : rep->results) { - if (ar.succeeded && !ar.from_cache && !ar.stderr_data.empty()) { - std::cerr << ar.stderr_data; - if (ar.stderr_data.back() != '\n') { - std::cerr << '\n'; - } - } - } + print_action_warnings(*rep); Void::Log::info("Build", "[{}] Finished in {:.2f}s ({} executed, {} cached)", prof_name, prof_sw.elapsed_ms() / 1000.0, rep->executed_count, rep->cached_count); std::cout << "vbs: [" << prof_name << "] built (" << rep->executed_count << " executed, " @@ -2679,6 +2683,7 @@ int execute_install_command(const InstallCmdOptions &opts) { } return 1; } + print_action_warnings(*exec); Void::Log::info("Install", "Staging and installing package '{}' ({}) to '{}'...", iopts.package_name, iopts.package_version, iopts.prefix.string()); auto inst = Install::install_project(*desc, *graph, iopts);