Use stricter C++ compiler flags

Enable more warnings, and treat all warnings as errors. This would have caught the incomplete switch fixed in f5f89be659.
This commit is contained in:
Oliver Hamlet
2025-08-12 19:10:01 +01:00
parent f5f89be659
commit d5ff75ee31
4 changed files with 55 additions and 9 deletions
+7 -6
View File
@@ -43,8 +43,6 @@ LogLevel convert(uint8_t level) {
return LogLevel::info;
} else if (level == LIBLOOT_LOG_LEVEL_WARNING) {
return LogLevel::warning;
} else if (level == LIBLOOT_LOG_LEVEL_ERROR) {
return LogLevel::error;
} else {
return LogLevel::error;
}
@@ -67,10 +65,13 @@ loot::rust::LogLevel convert(LogLevel level) {
}
}
void loggingCallback(uint8_t level, const char* message, void* context) {
auto& callback = *static_cast<Callback*>(context);
callback(convert(level), message);
void loggingCallback(uint8_t level, const char* message, void* context) noexcept {
try {
auto& callback = *static_cast<Callback*>(context);
callback(convert(level), message);
} catch (...) {
// Can't do anything with the exception.
}
}
}
+2
View File
@@ -31,6 +31,8 @@ std::optional<loot::EdgeType> convert(loot::rust::EdgeType edgeType) {
return loot::EdgeType::tieBreak;
case loot::rust::EdgeType::BlueprintMaster:
return loot::EdgeType::blueprintMaster;
case loot::rust::EdgeType::None:
return std::nullopt;
default:
return std::nullopt;
}
+1 -1
View File
@@ -39,7 +39,7 @@ namespace {
template<typename T>
std::vector<T> mergeVectors(std::vector<T> first,
const std::vector<T>& second) {
const auto initialSizeOfFirst = first.size();
const auto initialSizeOfFirst = first.end() - first.begin();
for (const auto& element : second) {
const auto end = first.cbegin() + initialSizeOfFirst;