general: Enforce C4800 everywhere except in video_core
This commit is contained in:
parent
93297d14d8
commit
e6ab1f673b
14 changed files with 57 additions and 41 deletions
|
@ -76,6 +76,7 @@ if (MSVC)
|
|||
/we4549 # 'operator1': operator before comma has no effect; did you intend 'operator2'?
|
||||
/we4555 # Expression has no effect; expected expression with side-effect
|
||||
/we4715 # 'function': not all control paths return a value
|
||||
/we4826 # Conversion from 'type1' to 'type2' is sign-extended. This may cause unexpected runtime behavior.
|
||||
/we4834 # Discarding return value of function with 'nodiscard' attribute
|
||||
/we5038 # data member 'member1' will be initialized after data member 'member2'
|
||||
/we5245 # 'function': unreferenced function with internal linkage has been removed
|
||||
|
|
|
@ -206,6 +206,7 @@ if (MSVC)
|
|||
/we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data
|
||||
/we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch
|
||||
/we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
|
||||
/we4800 # Implicit conversion from 'type' to bool. Possible information loss
|
||||
)
|
||||
else()
|
||||
target_compile_options(audio_core PRIVATE
|
||||
|
|
|
@ -157,6 +157,12 @@ if (MSVC)
|
|||
target_compile_options(common PRIVATE
|
||||
/W4
|
||||
/WX
|
||||
|
||||
/we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data
|
||||
/we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data
|
||||
/we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch
|
||||
/we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
|
||||
/we4800 # Implicit conversion from 'type' to bool. Possible information loss
|
||||
)
|
||||
else()
|
||||
target_compile_options(common PRIVATE
|
||||
|
|
|
@ -141,10 +141,6 @@ public:
|
|||
constexpr BitField(BitField&&) noexcept = default;
|
||||
constexpr BitField& operator=(BitField&&) noexcept = default;
|
||||
|
||||
[[nodiscard]] constexpr operator T() const {
|
||||
return Value();
|
||||
}
|
||||
|
||||
constexpr void Assign(const T& value) {
|
||||
#ifdef _MSC_VER
|
||||
storage = static_cast<StorageType>((storage & ~mask) | FormatValue(value));
|
||||
|
@ -162,6 +158,17 @@ public:
|
|||
return ExtractValue(storage);
|
||||
}
|
||||
|
||||
template <typename ConvertedToType>
|
||||
[[nodiscard]] constexpr ConvertedToType As() const {
|
||||
static_assert(!std::is_same_v<T, ConvertedToType>,
|
||||
"Unnecessary cast. Use Value() instead.");
|
||||
return static_cast<ConvertedToType>(Value());
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr operator T() const {
|
||||
return Value();
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr explicit operator bool() const {
|
||||
return Value() != 0;
|
||||
}
|
||||
|
|
|
@ -774,6 +774,7 @@ if (MSVC)
|
|||
/we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data
|
||||
/we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch
|
||||
/we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
|
||||
/we4800 # Implicit conversion from 'type' to bool. Possible information loss
|
||||
)
|
||||
else()
|
||||
target_compile_options(core PRIVATE
|
||||
|
|
|
@ -127,7 +127,7 @@ void ProgramMetadata::LoadManual(bool is_64_bit, ProgramAddressSpaceType address
|
|||
}
|
||||
|
||||
bool ProgramMetadata::Is64BitProgram() const {
|
||||
return npdm_header.has_64_bit_instructions;
|
||||
return npdm_header.has_64_bit_instructions.As<bool>();
|
||||
}
|
||||
|
||||
ProgramAddressSpaceType ProgramMetadata::GetAddressSpaceType() const {
|
||||
|
|
|
@ -1158,27 +1158,27 @@ bool EmulatedController::IsControllerSupported(bool use_temporary_value) const {
|
|||
const auto type = is_configuring && use_temporary_value ? tmp_npad_type : npad_type;
|
||||
switch (type) {
|
||||
case NpadStyleIndex::ProController:
|
||||
return supported_style_tag.fullkey;
|
||||
return supported_style_tag.fullkey.As<bool>();
|
||||
case NpadStyleIndex::Handheld:
|
||||
return supported_style_tag.handheld;
|
||||
return supported_style_tag.handheld.As<bool>();
|
||||
case NpadStyleIndex::JoyconDual:
|
||||
return supported_style_tag.joycon_dual;
|
||||
return supported_style_tag.joycon_dual.As<bool>();
|
||||
case NpadStyleIndex::JoyconLeft:
|
||||
return supported_style_tag.joycon_left;
|
||||
return supported_style_tag.joycon_left.As<bool>();
|
||||
case NpadStyleIndex::JoyconRight:
|
||||
return supported_style_tag.joycon_right;
|
||||
return supported_style_tag.joycon_right.As<bool>();
|
||||
case NpadStyleIndex::GameCube:
|
||||
return supported_style_tag.gamecube;
|
||||
return supported_style_tag.gamecube.As<bool>();
|
||||
case NpadStyleIndex::Pokeball:
|
||||
return supported_style_tag.palma;
|
||||
return supported_style_tag.palma.As<bool>();
|
||||
case NpadStyleIndex::NES:
|
||||
return supported_style_tag.lark;
|
||||
return supported_style_tag.lark.As<bool>();
|
||||
case NpadStyleIndex::SNES:
|
||||
return supported_style_tag.lucia;
|
||||
return supported_style_tag.lucia.As<bool>();
|
||||
case NpadStyleIndex::N64:
|
||||
return supported_style_tag.lagoon;
|
||||
return supported_style_tag.lagoon.As<bool>();
|
||||
case NpadStyleIndex::SegaGenesis:
|
||||
return supported_style_tag.lager;
|
||||
return supported_style_tag.lager.As<bool>();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -751,8 +751,8 @@ static void Break(Core::System& system, u32 reason, u64 info1, u64 info2) {
|
|||
}
|
||||
|
||||
system.GetReporter().SaveSvcBreakReport(
|
||||
static_cast<u32>(break_reason.break_type.Value()), break_reason.signal_debugger, info1,
|
||||
info2, has_dumped_buffer ? std::make_optional(debug_buffer) : std::nullopt);
|
||||
static_cast<u32>(break_reason.break_type.Value()), break_reason.signal_debugger.As<bool>(),
|
||||
info1, info2, has_dumped_buffer ? std::make_optional(debug_buffer) : std::nullopt);
|
||||
|
||||
if (!break_reason.signal_debugger) {
|
||||
LOG_CRITICAL(
|
||||
|
|
|
@ -164,7 +164,7 @@ protected:
|
|||
u32_le size;
|
||||
u32_le library_version;
|
||||
u32_le theme_color;
|
||||
u8 play_startup_sound;
|
||||
bool play_startup_sound;
|
||||
u64_le system_tick;
|
||||
};
|
||||
static_assert(sizeof(CommonArguments) == 0x20, "CommonArguments has incorrect size.");
|
||||
|
|
|
@ -1502,25 +1502,25 @@ bool Controller_NPad::IsControllerSupported(Core::HID::NpadStyleIndex controller
|
|||
Core::HID::NpadStyleTag style = GetSupportedStyleSet();
|
||||
switch (controller) {
|
||||
case Core::HID::NpadStyleIndex::ProController:
|
||||
return style.fullkey;
|
||||
return style.fullkey.As<bool>();
|
||||
case Core::HID::NpadStyleIndex::JoyconDual:
|
||||
return style.joycon_dual;
|
||||
return style.joycon_dual.As<bool>();
|
||||
case Core::HID::NpadStyleIndex::JoyconLeft:
|
||||
return style.joycon_left;
|
||||
return style.joycon_left.As<bool>();
|
||||
case Core::HID::NpadStyleIndex::JoyconRight:
|
||||
return style.joycon_right;
|
||||
return style.joycon_right.As<bool>();
|
||||
case Core::HID::NpadStyleIndex::GameCube:
|
||||
return style.gamecube;
|
||||
return style.gamecube.As<bool>();
|
||||
case Core::HID::NpadStyleIndex::Pokeball:
|
||||
return style.palma;
|
||||
return style.palma.As<bool>();
|
||||
case Core::HID::NpadStyleIndex::NES:
|
||||
return style.lark;
|
||||
return style.lark.As<bool>();
|
||||
case Core::HID::NpadStyleIndex::SNES:
|
||||
return style.lucia;
|
||||
return style.lucia.As<bool>();
|
||||
case Core::HID::NpadStyleIndex::N64:
|
||||
return style.lagoon;
|
||||
return style.lagoon.As<bool>();
|
||||
case Core::HID::NpadStyleIndex::SegaGenesis:
|
||||
return style.lager;
|
||||
return style.lager.As<bool>();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ if (MSVC)
|
|||
/we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data
|
||||
/we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch
|
||||
/we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
|
||||
/we4800 # Implicit conversion from 'type' to bool. Possible information loss
|
||||
)
|
||||
else()
|
||||
target_compile_options(input_common PRIVATE
|
||||
|
|
|
@ -40,8 +40,8 @@ public:
|
|||
void EnableMotion() {
|
||||
if (sdl_controller) {
|
||||
SDL_GameController* controller = sdl_controller.get();
|
||||
has_accel = SDL_GameControllerHasSensor(controller, SDL_SENSOR_ACCEL);
|
||||
has_gyro = SDL_GameControllerHasSensor(controller, SDL_SENSOR_GYRO);
|
||||
has_accel = SDL_GameControllerHasSensor(controller, SDL_SENSOR_ACCEL) == SDL_TRUE;
|
||||
has_gyro = SDL_GameControllerHasSensor(controller, SDL_SENSOR_GYRO) == SDL_TRUE;
|
||||
if (has_accel) {
|
||||
SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_ACCEL, SDL_TRUE);
|
||||
}
|
||||
|
|
|
@ -797,8 +797,8 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateButtonDevice(
|
|||
|
||||
const auto button_id = params.Get("button", 0);
|
||||
const auto keyboard_key = params.Get("code", 0);
|
||||
const auto toggle = params.Get("toggle", false);
|
||||
const auto inverted = params.Get("inverted", false);
|
||||
const auto toggle = params.Get("toggle", false) != 0;
|
||||
const auto inverted = params.Get("inverted", false) != 0;
|
||||
input_engine->PreSetController(identifier);
|
||||
input_engine->PreSetButton(identifier, button_id);
|
||||
input_engine->PreSetButton(identifier, keyboard_key);
|
||||
|
@ -820,8 +820,8 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateHatButtonDevice(
|
|||
|
||||
const auto button_id = params.Get("hat", 0);
|
||||
const auto direction = input_engine->GetHatButtonId(params.Get("direction", ""));
|
||||
const auto toggle = params.Get("toggle", false);
|
||||
const auto inverted = params.Get("inverted", false);
|
||||
const auto toggle = params.Get("toggle", false) != 0;
|
||||
const auto inverted = params.Get("inverted", false) != 0;
|
||||
|
||||
input_engine->PreSetController(identifier);
|
||||
input_engine->PreSetHatButton(identifier, button_id);
|
||||
|
@ -879,7 +879,7 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateAnalogDevice(
|
|||
.threshold = std::clamp(params.Get("threshold", 0.5f), 0.0f, 1.0f),
|
||||
.offset = std::clamp(params.Get("offset", 0.0f), -1.0f, 1.0f),
|
||||
.inverted = params.Get("invert", "+") == "-",
|
||||
.toggle = static_cast<bool>(params.Get("toggle", false)),
|
||||
.toggle = params.Get("toggle", false) != 0,
|
||||
};
|
||||
input_engine->PreSetController(identifier);
|
||||
input_engine->PreSetAxis(identifier, axis);
|
||||
|
@ -895,8 +895,8 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateTriggerDevice(
|
|||
};
|
||||
|
||||
const auto button = params.Get("button", 0);
|
||||
const auto toggle = params.Get("toggle", false);
|
||||
const auto inverted = params.Get("inverted", false);
|
||||
const auto toggle = params.Get("toggle", false) != 0;
|
||||
const auto inverted = params.Get("inverted", false) != 0;
|
||||
|
||||
const auto axis = params.Get("axis", 0);
|
||||
const Common::Input::AnalogProperties properties = {
|
||||
|
@ -926,8 +926,8 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateTouchDevice(
|
|||
};
|
||||
|
||||
const auto button = params.Get("button", 0);
|
||||
const auto toggle = params.Get("toggle", false);
|
||||
const auto inverted = params.Get("inverted", false);
|
||||
const auto toggle = params.Get("toggle", false) != 0;
|
||||
const auto inverted = params.Get("inverted", false) != 0;
|
||||
|
||||
const auto axis_x = params.Get("axis_x", 0);
|
||||
const Common::Input::AnalogProperties properties_x = {
|
||||
|
|
|
@ -248,7 +248,6 @@ if (MSVC)
|
|||
/we4245 # 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch
|
||||
/we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
|
||||
/we4800 # Implicit conversion from 'type' to bool. Possible information loss
|
||||
/we4826 # Conversion from 'type1' to 'type2' is sign-extended. This may cause unexpected runtime behavior.
|
||||
)
|
||||
else()
|
||||
target_compile_options(shader_recompiler PRIVATE
|
||||
|
|
Loading…
Reference in a new issue