MSVC: clear some warning

Disable warning with pragma in arm_dyncom_trans.h
Type refactoring signed/unsigned
Type cast  32/64 bit
This commit is contained in:
Thonnat 2017-06-02 17:03:36 +02:00
parent 4857eb441b
commit 080cdb35d8
18 changed files with 45 additions and 17 deletions

View File

@ -87,7 +87,9 @@ const char* GetLogClassName(Class log_class) {
#undef CLS
#undef SUB
case Class::Count:
default:
UNREACHABLE();
return {};
}
}
@ -103,7 +105,9 @@ const char* GetLevelName(Level log_level) {
LVL(Error);
LVL(Critical);
case Level::Count:
default:
UNREACHABLE();
return {};
}
#undef LVL
}

View File

@ -91,7 +91,7 @@ public:
y -= other.y;
}
template <typename Q = T, class = typename std::enable_if<std::is_signed<Q>::value>::type>
Vec2<decltype(-T{})> operator-() const {
Vec2<decltype(-Q{})> operator-() const {
return MakeVec(-x, -y);
}
Vec2<decltype(T{} * T{})> operator*(const Vec2& other) const {

View File

@ -125,7 +125,7 @@ public:
* Advance the CPU core by the specified number of ticks (e.g. to simulate CPU execution time)
* @param ticks Number of ticks to advance the CPU core
*/
virtual void AddTicks(u64 ticks) = 0;
virtual void AddTicks(size_t ticks) = 0;
/**
* Saves the current CPU context

View File

@ -124,7 +124,7 @@ void ARM_Dynarmic::SetCP15Register(CP15Register reg, u32 value) {
interpreter_state->CP15[reg] = value;
}
void ARM_Dynarmic::AddTicks(u64 ticks) {
void ARM_Dynarmic::AddTicks(size_t ticks) {
down_count -= ticks;
if (down_count < 0) {
CoreTiming::Advance();
@ -136,7 +136,7 @@ MICROPROFILE_DEFINE(ARM_Jit, "ARM JIT", "ARM JIT", MP_RGB(255, 64, 64));
void ARM_Dynarmic::ExecuteInstructions(int num_instructions) {
MICROPROFILE_SCOPE(ARM_Jit);
unsigned ticks_executed = jit->Run(static_cast<unsigned>(num_instructions));
size_t ticks_executed = jit->Run(static_cast<unsigned>(num_instructions));
AddTicks(ticks_executed);
}

View File

@ -27,7 +27,7 @@ public:
u32 GetCP15Register(CP15Register reg) override;
void SetCP15Register(CP15Register reg, u32 value) override;
void AddTicks(u64 ticks) override;
void AddTicks(size_t ticks) override;
void SaveContext(ThreadContext& ctx) override;
void LoadContext(const ThreadContext& ctx) override;

View File

@ -759,7 +759,7 @@ static ThumbDecodeStatus DecodeThumbInstruction(u32 inst, u32 addr, u32* arm_ins
ThumbDecodeStatus ret = TranslateThumbInstruction(addr, inst, arm_inst, inst_size);
if (ret == ThumbDecodeStatus::BRANCH) {
int inst_index;
int table_length = arm_instruction_trans_len;
int table_length = static_cast<int>(arm_instruction_trans_len);
u32 tinstr = GetThumbInstruction(inst, addr);
switch ((tinstr & 0xF800) >> 11) {
@ -848,7 +848,7 @@ static int InterpreterTranslateBlock(ARMul_State* cpu, int& bb_start, u32 addr)
ARM_INST_PTR inst_base = nullptr;
TransExtData ret = TransExtData::NON_BRANCH;
int size = 0; // instruction size of basic block
bb_start = trans_cache_buf_top;
bb_start = static_cast<int>(trans_cache_buf_top);
u32 phys_addr = addr;
u32 pc_start = cpu->Reg[15];
@ -875,7 +875,7 @@ static int InterpreterTranslateSingle(ARMul_State* cpu, int& bb_start, u32 addr)
MICROPROFILE_SCOPE(DynCom_Decode);
ARM_INST_PTR inst_base = nullptr;
bb_start = trans_cache_buf_top;
bb_start = static_cast<int>(trans_cache_buf_top);
u32 phys_addr = addr;
u32 pc_start = cpu->Reg[15];

View File

@ -18,12 +18,19 @@ enum class TransExtData {
SINGLE_STEP = (1 << 8)
};
#ifdef _WIN32
#pragma warning( push )
#pragma warning( disable : 4200)
#endif // WIN
struct arm_inst {
unsigned int idx;
unsigned int cond;
TransExtData br;
char component[0];
};
#ifdef _WIN32
#pragma warning( pop )
#endif // WIN
struct generic_arm_inst {
u32 Ra;

View File

@ -89,6 +89,9 @@ std::u16string Path::AsU16Str() const {
// TODO(yuriks): Add assert
LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!");
return {};
default:
LOG_ERROR(Service_FS, "Bad conversion type for LowPathType!");
return {};
}
}

View File

@ -77,8 +77,8 @@ void EmuWindow::AccelerometerChanged(float x, float y, float z) {
void EmuWindow::GyroscopeChanged(float x, float y, float z) {
constexpr float FULL_FPS = 60;
float coef = GetGyroscopeRawToDpsCoefficient();
float stretch = Core::System::GetInstance().perf_stats.GetLastFrameTimeScale();
f32 coef = GetGyroscopeRawToDpsCoefficient();
double stretch = Core::System::GetInstance().perf_stats.GetLastFrameTimeScale();
std::lock_guard<std::mutex> lock(gyro_mutex);
gyro_x = static_cast<s16>(x * coef * stretch);
gyro_y = static_cast<s16>(y * coef * stretch);

View File

@ -83,8 +83,8 @@ union Header {
* @note While @p normal_params_size is equivalent to the number of normal parameters,
* @p translate_params_size includes the size occupied by the translate parameters headers.
*/
inline u32 MakeHeader(u16 command_id, unsigned int normal_params_size,
unsigned int translate_params_size) {
inline u32 MakeHeader(u16 command_id, u32 normal_params_size,
u32 translate_params_size) {
Header header{};
header.command_id.Assign(command_id);
header.normal_params_size.Assign(normal_params_size);

View File

@ -36,7 +36,7 @@ public:
}
int lock_count; ///< Number of times the mutex has been acquired
u32 priority; ///< The priority of the mutex, used for priority inheritance.
s32 priority; ///< The priority of the mutex, used for priority inheritance.
std::string name; ///< Name of mutex (optional)
SharedPtr<Thread> holding_thread; ///< Thread that has acquired the mutex

View File

@ -412,7 +412,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
return ERR_OUT_OF_MEMORY;
}
u32 offset = linheap_memory->size();
size_t offset = linheap_memory->size();
// Allocate some memory from the end of the linear heap for this region.
linheap_memory->insert(linheap_memory->end(), Memory::PAGE_SIZE, 0);
@ -522,7 +522,7 @@ void Thread::SetWaitSynchronizationOutput(s32 output) {
context.cpu_registers[1] = output;
}
s32 Thread::GetWaitObjectIndex(WaitObject* object) const {
s64 Thread::GetWaitObjectIndex(WaitObject* object) const {
ASSERT_MSG(!wait_objects.empty(), "Thread is not waiting for anything");
auto match = std::find(wait_objects.rbegin(), wait_objects.rend(), object);
return std::distance(match, wait_objects.rend()) - 1;

View File

@ -142,7 +142,7 @@ public:
* object in the list.
* @param object Object to query the index of.
*/
s32 GetWaitObjectIndex(WaitObject* object) const;
s64 GetWaitObjectIndex(WaitObject* object) const;
/**
* Stops a thread, invalidating it from further use

View File

@ -514,7 +514,8 @@ static ResultCode CreateThread(Kernel::Handle* out_handle, u32 priority, u32 ent
using Kernel::ResourceLimit;
Kernel::SharedPtr<ResourceLimit>& resource_limit = Kernel::g_current_process->resource_limit;
if (resource_limit->GetMaxResourceValue(Kernel::ResourceTypes::PRIORITY) > priority) {
if (resource_limit->GetMaxResourceValue(Kernel::ResourceTypes::PRIORITY) >
static_cast<s32>(priority)) {
return Kernel::ERR_NOT_AUTHORIZED;
}

View File

@ -76,6 +76,7 @@ struct Regs {
return 2;
default:
UNIMPLEMENTED();
return 0;
}
}

View File

@ -259,6 +259,7 @@ struct FramebufferRegs {
default:
LOG_CRITICAL(HW_GPU, "Unknown depth format %u", format);
UNIMPLEMENTED();
return -1;
}
}
@ -273,6 +274,7 @@ struct FramebufferRegs {
default:
LOG_CRITICAL(HW_GPU, "Unknown depth format %u", format);
UNIMPLEMENTED();
return -1;
}
}

View File

@ -351,6 +351,9 @@ u8 LogicOp(u8 src, u8 dest, FramebufferRegs::LogicOp op) {
case FramebufferRegs::LogicOp::OrInverted:
return ~src | dest;
default:
UNIMPLEMENTED();
return 0;
}
};

View File

@ -77,6 +77,9 @@ Math::Vec3<u8> GetColorModifier(TevStageConfig::ColorModifier factor,
case ColorModifier::OneMinusSourceBlue:
return (Math::Vec3<u8>(255, 255, 255) - values.bbb()).Cast<u8>();
default:
UNIMPLEMENTED();
return Math::Vec3<u8>();
}
};
@ -107,7 +110,11 @@ u8 GetAlphaModifier(TevStageConfig::AlphaModifier factor, const Math::Vec4<u8>&
case AlphaModifier::OneMinusSourceBlue:
return 255 - values.b();
default:
UNIMPLEMENTED();
return -1;
}
};
Math::Vec3<u8> ColorCombine(TevStageConfig::Operation op, const Math::Vec3<u8> input[3]) {