Browse Source

fix excepts

lizzie/noexcept-dynarmic
lizzie 3 weeks ago
parent
commit
035caec801
  1. 26
      src/common/settings_setting.h
  2. 1
      src/dynarmic/CMakeLists.txt

26
src/common/settings_setting.h

@ -188,22 +188,16 @@ public:
this->SetValue(this->GetDefault());
return;
}
try {
if constexpr (std::is_same_v<Type, std::string>) {
this->SetValue(input);
} else if constexpr (std::is_same_v<Type, std::optional<u32>>) {
this->SetValue(u32(std::stoul(input)));
} else if constexpr (std::is_same_v<Type, bool>) {
this->SetValue(input == "true");
} else if constexpr (std::is_same_v<Type, float>) {
this->SetValue(std::stof(input));
} else {
this->SetValue(Type(std::stoll(input)));
}
} catch (std::invalid_argument&) {
this->SetValue(this->GetDefault());
} catch (std::out_of_range&) {
this->SetValue(this->GetDefault());
if constexpr (std::is_same_v<Type, std::string>) {
this->SetValue(input);
} else if constexpr (std::is_same_v<Type, std::optional<u32>>) {
this->SetValue(u32(std::strtoul(input.c_str(), NULL, 10)));
} else if constexpr (std::is_same_v<Type, bool>) {
this->SetValue(input == "true");
} else if constexpr (std::is_same_v<Type, float>) {
this->SetValue(std::strtof(input.c_str(), NULL));
} else {
this->SetValue(Type(std::strtoll(input.c_str(), NULL)));
}
}

1
src/dynarmic/CMakeLists.txt

@ -95,7 +95,6 @@ else()
-pedantic
-Wno-missing-braces
-fno-rtti
#-fno-exceptions
)
if (CXX_GCC)
# GCC produces bogus -Warray-bounds warnings from xbyak headers for code paths that are not

Loading…
Cancel
Save