Sfoglia il codice sorgente

Merge pull request #2888 from Subv/warnings

Fixed some warnings in the core project.
James Rowe 9 anni fa
parent
commit
a8675f4287

+ 1 - 1
src/core/arm/dynarmic/arm_dynarmic.cpp

@@ -136,7 +136,7 @@ MICROPROFILE_DEFINE(ARM_Jit, "ARM JIT", "ARM JIT", MP_RGB(255, 64, 64));
 void ARM_Dynarmic::ExecuteInstructions(int num_instructions) {
 void ARM_Dynarmic::ExecuteInstructions(int num_instructions) {
     MICROPROFILE_SCOPE(ARM_Jit);
     MICROPROFILE_SCOPE(ARM_Jit);
 
 
-    unsigned ticks_executed = jit->Run(static_cast<unsigned>(num_instructions));
+    std::size_t ticks_executed = jit->Run(static_cast<unsigned>(num_instructions));
 
 
     AddTicks(ticks_executed);
     AddTicks(ticks_executed);
 }
 }

+ 4 - 4
src/core/arm/dyncom/arm_dyncom_interpreter.cpp

@@ -759,7 +759,7 @@ static ThumbDecodeStatus DecodeThumbInstruction(u32 inst, u32 addr, u32* arm_ins
     ThumbDecodeStatus ret = TranslateThumbInstruction(addr, inst, arm_inst, inst_size);
     ThumbDecodeStatus ret = TranslateThumbInstruction(addr, inst, arm_inst, inst_size);
     if (ret == ThumbDecodeStatus::BRANCH) {
     if (ret == ThumbDecodeStatus::BRANCH) {
         int inst_index;
         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);
         u32 tinstr = GetThumbInstruction(inst, addr);
 
 
         switch ((tinstr & 0xF800) >> 11) {
         switch ((tinstr & 0xF800) >> 11) {
@@ -838,7 +838,7 @@ static unsigned int InterpreterTranslateInstruction(const ARMul_State* cpu, cons
     return inst_size;
     return inst_size;
 }
 }
 
 
-static int InterpreterTranslateBlock(ARMul_State* cpu, int& bb_start, u32 addr) {
+static int InterpreterTranslateBlock(ARMul_State* cpu, std::size_t& bb_start, u32 addr) {
     MICROPROFILE_SCOPE(DynCom_Decode);
     MICROPROFILE_SCOPE(DynCom_Decode);
 
 
     // Decode instruction, get index
     // Decode instruction, get index
@@ -871,7 +871,7 @@ static int InterpreterTranslateBlock(ARMul_State* cpu, int& bb_start, u32 addr)
     return KEEP_GOING;
     return KEEP_GOING;
 }
 }
 
 
-static int InterpreterTranslateSingle(ARMul_State* cpu, int& bb_start, u32 addr) {
+static int InterpreterTranslateSingle(ARMul_State* cpu, std::size_t& bb_start, u32 addr) {
     MICROPROFILE_SCOPE(DynCom_Decode);
     MICROPROFILE_SCOPE(DynCom_Decode);
 
 
     ARM_INST_PTR inst_base = nullptr;
     ARM_INST_PTR inst_base = nullptr;
@@ -1620,7 +1620,7 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) {
     unsigned int addr;
     unsigned int addr;
     unsigned int num_instrs = 0;
     unsigned int num_instrs = 0;
 
 
-    int ptr;
+    std::size_t ptr;
 
 
     LOAD_NZCVT;
     LOAD_NZCVT;
 DISPATCH : {
 DISPATCH : {

+ 1 - 1
src/core/arm/skyeye_common/armstate.h

@@ -230,7 +230,7 @@ public:
 
 
     // TODO(bunnei): Move this cache to a better place - it should be per codeset (likely per
     // TODO(bunnei): Move this cache to a better place - it should be per codeset (likely per
     // process for our purposes), not per ARMul_State (which tracks CPU core state).
     // process for our purposes), not per ARMul_State (which tracks CPU core state).
-    std::unordered_map<u32, int> instruction_cache;
+    std::unordered_map<u32, std::size_t> instruction_cache;
 
 
 private:
 private:
     void ResetMPCoreCP15Registers();
     void ResetMPCoreCP15Registers();

+ 2 - 0
src/core/file_sys/archive_backend.cpp

@@ -90,6 +90,8 @@ std::u16string Path::AsU16Str() const {
         LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!");
         LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!");
         return {};
         return {};
     }
     }
+
+    UNREACHABLE();
 }
 }
 
 
 std::vector<u8> Path::AsBinary() const {
 std::vector<u8> Path::AsBinary() const {

+ 2 - 2
src/core/hle/applets/erreula.cpp

@@ -31,8 +31,8 @@ ResultCode ErrEula::ReceiveParameter(const Service::APT::MessageParameter& param
     heap_memory = std::make_shared<std::vector<u8>>(capture_info.size);
     heap_memory = std::make_shared<std::vector<u8>>(capture_info.size);
     // Create a SharedMemory that directly points to this heap block.
     // Create a SharedMemory that directly points to this heap block.
     framebuffer_memory = Kernel::SharedMemory::CreateForApplet(
     framebuffer_memory = Kernel::SharedMemory::CreateForApplet(
-        heap_memory, 0, heap_memory->size(), MemoryPermission::ReadWrite,
-        MemoryPermission::ReadWrite, "ErrEula Memory");
+        heap_memory, 0, capture_info.size, MemoryPermission::ReadWrite, MemoryPermission::ReadWrite,
+        "ErrEula Memory");
 
 
     // Send the response message with the newly created SharedMemory
     // Send the response message with the newly created SharedMemory
     Service::APT::MessageParameter result;
     Service::APT::MessageParameter result;

+ 2 - 2
src/core/hle/applets/mii_selector.cpp

@@ -38,8 +38,8 @@ ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& p
     heap_memory = std::make_shared<std::vector<u8>>(capture_info.size);
     heap_memory = std::make_shared<std::vector<u8>>(capture_info.size);
     // Create a SharedMemory that directly points to this heap block.
     // Create a SharedMemory that directly points to this heap block.
     framebuffer_memory = Kernel::SharedMemory::CreateForApplet(
     framebuffer_memory = Kernel::SharedMemory::CreateForApplet(
-        heap_memory, 0, heap_memory->size(), MemoryPermission::ReadWrite,
-        MemoryPermission::ReadWrite, "MiiSelector Memory");
+        heap_memory, 0, capture_info.size, MemoryPermission::ReadWrite, MemoryPermission::ReadWrite,
+        "MiiSelector Memory");
 
 
     // Send the response message with the newly created SharedMemory
     // Send the response message with the newly created SharedMemory
     Service::APT::MessageParameter result;
     Service::APT::MessageParameter result;

+ 2 - 2
src/core/hle/applets/mint.cpp

@@ -31,8 +31,8 @@ ResultCode Mint::ReceiveParameter(const Service::APT::MessageParameter& paramete
     heap_memory = std::make_shared<std::vector<u8>>(capture_info.size);
     heap_memory = std::make_shared<std::vector<u8>>(capture_info.size);
     // Create a SharedMemory that directly points to this heap block.
     // Create a SharedMemory that directly points to this heap block.
     framebuffer_memory = Kernel::SharedMemory::CreateForApplet(
     framebuffer_memory = Kernel::SharedMemory::CreateForApplet(
-        heap_memory, 0, heap_memory->size(), MemoryPermission::ReadWrite,
-        MemoryPermission::ReadWrite, "Mint Memory");
+        heap_memory, 0, capture_info.size, MemoryPermission::ReadWrite, MemoryPermission::ReadWrite,
+        "Mint Memory");
 
 
     // Send the response message with the newly created SharedMemory
     // Send the response message with the newly created SharedMemory
     Service::APT::MessageParameter result;
     Service::APT::MessageParameter result;

+ 2 - 2
src/core/hle/applets/swkbd.cpp

@@ -41,8 +41,8 @@ ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter con
     heap_memory = std::make_shared<std::vector<u8>>(capture_info.size);
     heap_memory = std::make_shared<std::vector<u8>>(capture_info.size);
     // Create a SharedMemory that directly points to this heap block.
     // Create a SharedMemory that directly points to this heap block.
     framebuffer_memory = Kernel::SharedMemory::CreateForApplet(
     framebuffer_memory = Kernel::SharedMemory::CreateForApplet(
-        heap_memory, 0, heap_memory->size(), MemoryPermission::ReadWrite,
-        MemoryPermission::ReadWrite, "SoftwareKeyboard Memory");
+        heap_memory, 0, capture_info.size, MemoryPermission::ReadWrite, MemoryPermission::ReadWrite,
+        "SoftwareKeyboard Memory");
 
 
     // Send the response message with the newly created SharedMemory
     // Send the response message with the newly created SharedMemory
     Service::APT::MessageParameter result;
     Service::APT::MessageParameter result;

+ 3 - 0
src/core/hle/kernel/kernel.h

@@ -8,6 +8,7 @@
 #include <string>
 #include <string>
 #include <utility>
 #include <utility>
 #include <boost/smart_ptr/intrusive_ptr.hpp>
 #include <boost/smart_ptr/intrusive_ptr.hpp>
+#include "common/assert.h"
 #include "common/common_types.h"
 #include "common/common_types.h"
 
 
 namespace Kernel {
 namespace Kernel {
@@ -84,6 +85,8 @@ public:
         case HandleType::ClientSession:
         case HandleType::ClientSession:
             return false;
             return false;
         }
         }
+
+        UNREACHABLE();
     }
     }
 
 
 public:
 public:

+ 1 - 1
src/core/hw/gpu.cpp

@@ -29,7 +29,7 @@ namespace GPU {
 Regs g_regs;
 Regs g_regs;
 
 
 /// 268MHz CPU clocks / 60Hz frames per second
 /// 268MHz CPU clocks / 60Hz frames per second
-const u64 frame_ticks = BASE_CLOCK_RATE_ARM11 / SCREEN_REFRESH_RATE;
+const u64 frame_ticks = static_cast<u64>(BASE_CLOCK_RATE_ARM11 / SCREEN_REFRESH_RATE);
 /// Event id for CoreTiming
 /// Event id for CoreTiming
 static int vblank_event;
 static int vblank_event;
 
 

+ 2 - 2
src/core/hw/gpu.h

@@ -74,9 +74,9 @@ struct Regs {
         case PixelFormat::RGB5A1:
         case PixelFormat::RGB5A1:
         case PixelFormat::RGBA4:
         case PixelFormat::RGBA4:
             return 2;
             return 2;
-        default:
-            UNIMPLEMENTED();
         }
         }
+
+        UNREACHABLE();
     }
     }
 
 
     INSERT_PADDING_WORDS(0x4);
     INSERT_PADDING_WORDS(0x4);