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.
This commit is contained in:
Michalis Kokologiannakis 2025-11-14 20:15:10 +01:00
parent 5df5103f99
commit fbdf4aa3bb

View file

@ -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<std::string> warnings;
auto config_valid = conf->validate(warnings);
for (const auto& w : warnings)
WARN("{}", w);
if (auto* errors = std::get_if<ConfigErrorList>(&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<MiriGenmcShim>(std::move(conf), mode);