From fbdf4aa3bbba21914f2029404513cfae7532a4c2 Mon Sep 17 00:00:00 2001 From: Michalis Kokologiannakis Date: Fri, 14 Nov 2025 20:15:10 +0100 Subject: [PATCH] genmc/setup: Check GenMC config validity GenMC v0.14.1 does not throw an error internally if the config is invalid, but rather returns an appropriate error value. This commit has setup code in Miri check the returned value, and exit if there are any errors. --- .../miri/genmc-sys/cpp/src/MiriInterface/Setup.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/tools/miri/genmc-sys/cpp/src/MiriInterface/Setup.cpp b/src/tools/miri/genmc-sys/cpp/src/MiriInterface/Setup.cpp index 5455b1a8de7f..20c827221a92 100644 --- a/src/tools/miri/genmc-sys/cpp/src/MiriInterface/Setup.cpp +++ b/src/tools/miri/genmc-sys/cpp/src/MiriInterface/Setup.cpp @@ -147,9 +147,16 @@ static auto to_genmc_verbosity_level(const LogLevel log_level) -> VerbosityLevel // that is allowed to leak and memory that is not. conf->warnUnfreedMemory = false; - // FIXME(genmc,error handling): This function currently exits on error, but will return an - // error value in the future. The return value should be checked once this change is made. - checkConfig(*conf); + // Validate the config and exit if there are any errors + std::vector warnings; + auto config_valid = conf->validate(warnings); + for (const auto& w : warnings) + WARN("{}", w); + if (auto* errors = std::get_if(&config_valid); errors) { + for (const auto& e : *errors) + LOG(VerbosityLevel::Error, "{}", e); + exit(EUSER); + } // Create the actual driver and Miri-GenMC communication shim. auto driver = std::make_unique(std::move(conf), mode);