From a69ddf840c711a1f45c69fdf0aa6208d4f2cfe51 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Wed, 27 Nov 2013 22:22:39 -0800 Subject: [PATCH 1/6] Fix some formatting warnings. --- Core/MIPS/MIPSDisVFPU.cpp | 2 +- UI/MainScreen.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/MIPS/MIPSDisVFPU.cpp b/Core/MIPS/MIPSDisVFPU.cpp index 253858bb78..bea774bff9 100644 --- a/Core/MIPS/MIPSDisVFPU.cpp +++ b/Core/MIPS/MIPSDisVFPU.cpp @@ -532,7 +532,7 @@ namespace MIPSDis int vs = _VS; int imm = (int)((op >> 16) & 0xFF); const char *name = MIPSGetName(op); - sprintf(out, "%s%s\t%s, %s", name, VSuff(op), VN(vd, sz), VN(vs, sz), imm); + sprintf(out, "%s%s\t%s, %s, %d", name, VSuff(op), VN(vd, sz), VN(vs, sz), imm); } void Dis_Vf2h(MIPSOpcode op, char *out) diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index f413c9f6b3..9560ac23e9 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -189,9 +189,9 @@ void GameButton::Draw(UIContext &dc) { char discNumInfo[8]; if (ginfo->disc_total > 1) - sprintf(discNumInfo, "-DISC%d",ginfo->disc_number); + sprintf(discNumInfo, "-DISC%d", ginfo->disc_number); else - sprintf(discNumInfo, ""); + strcpy(discNumInfo, ""); dc.Draw()->Flush(); dc.RebindTexture(); From dd2e996838f184e201ff6c62f13284eefc7ff8fb Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Wed, 27 Nov 2013 22:30:48 -0800 Subject: [PATCH 2/6] Fix some type comparison warnings. --- Core/Debugger/DisassemblyManager.cpp | 2 +- Core/Debugger/SymbolMap.cpp | 34 ++++++++++++++-------------- Core/Debugger/SymbolMap.h | 2 ++ Core/HLE/proAdhoc.cpp | 10 ++++---- Core/HLE/sceNetAdhoc.cpp | 4 ++-- Core/MIPS/MIPS.cpp | 2 +- Windows/Debugger/Debugger_Disasm.cpp | 2 +- 7 files changed, 29 insertions(+), 27 deletions(-) diff --git a/Core/Debugger/DisassemblyManager.cpp b/Core/Debugger/DisassemblyManager.cpp index bdb69d989b..e68b154703 100644 --- a/Core/Debugger/DisassemblyManager.cpp +++ b/Core/Debugger/DisassemblyManager.cpp @@ -959,7 +959,7 @@ void DisassemblyData::createLines() break; } - int len = strlen(buffer); + size_t len = strlen(buffer); if (currentLine.size() != 0 && currentLine.size()+len >= maxChars) { DataEntry entry = {currentLine,currentPos-currentLineStart,lineCount++}; diff --git a/Core/Debugger/SymbolMap.cpp b/Core/Debugger/SymbolMap.cpp index 58d13973fd..72790235c1 100644 --- a/Core/Debugger/SymbolMap.cpp +++ b/Core/Debugger/SymbolMap.cpp @@ -228,8 +228,8 @@ SymbolType SymbolMap::GetSymbolType(u32 address) const bool SymbolMap::GetSymbolInfo(SymbolInfo *info, u32 address, SymbolType symmask) const { - u32 functionAddress = -1; - u32 dataAddress = -1; + u32 functionAddress = INVALID_ADDRESS; + u32 dataAddress = INVALID_ADDRESS; if (symmask & ST_FUNCTION) functionAddress = GetFunctionStart(address); @@ -237,9 +237,9 @@ bool SymbolMap::GetSymbolInfo(SymbolInfo *info, u32 address, SymbolType symmask) if (symmask & ST_DATA) dataAddress = GetDataStart(address); - if (functionAddress == -1 || dataAddress == -1) + if (functionAddress == INVALID_ADDRESS || dataAddress == INVALID_ADDRESS) { - if (functionAddress != -1) + if (functionAddress != INVALID_ADDRESS) { if (info != NULL) { @@ -251,7 +251,7 @@ bool SymbolMap::GetSymbolInfo(SymbolInfo *info, u32 address, SymbolType symmask) return true; } - if (dataAddress != -1) + if (dataAddress != INVALID_ADDRESS) { if (info != NULL) { @@ -283,7 +283,7 @@ u32 SymbolMap::GetNextSymbolAddress(u32 address, SymbolType symmask) const auto dataEntry = symmask & ST_DATA ? data.upper_bound(address) : data.end(); if (functionEntry == functions.end() && dataEntry == data.end()) - return -1; + return INVALID_ADDRESS; u32 funcAddress = (functionEntry != functions.end()) ? functionEntry->first : 0xFFFFFFFF; u32 dataAddress = (dataEntry != data.end()) ? dataEntry->first : 0xFFFFFFFF; @@ -302,12 +302,12 @@ const char *SymbolMap::GetDescription(unsigned int address) const const char* labelName = NULL; u32 funcStart = GetFunctionStart(address); - if (funcStart != -1) + if (funcStart != INVALID_ADDRESS) { labelName = GetLabelName(funcStart); } else { u32 dataStart = GetDataStart(address); - if (dataStart != -1) + if (dataStart != INVALID_ADDRESS) labelName = GetLabelName(dataStart); } @@ -384,7 +384,7 @@ u32 SymbolMap::GetFunctionStart(u32 address) const } // otherwise there's no function that contains this address - return -1; + return INVALID_ADDRESS; } if (it != functions.begin()) @@ -397,14 +397,14 @@ u32 SymbolMap::GetFunctionStart(u32 address) const return start; } - return -1; + return INVALID_ADDRESS; } u32 SymbolMap::GetFunctionSize(u32 startAddress) const { auto it = functions.find(startAddress); if (it == functions.end()) - return -1; + return INVALID_ADDRESS; return it->second.size; } @@ -412,12 +412,12 @@ u32 SymbolMap::GetFunctionSize(u32 startAddress) const int SymbolMap::GetFunctionNum(u32 address) const { u32 start = GetFunctionStart(address); - if (start == -1) - return -1; + if (start == INVALID_ADDRESS) + return INVALID_ADDRESS; auto it = functions.find(start); if (it == functions.end()) - return -1; + return INVALID_ADDRESS; return it->second.index; } @@ -548,7 +548,7 @@ u32 SymbolMap::GetDataStart(u32 address) const } // otherwise there's no data that contains this address - return -1; + return INVALID_ADDRESS; } if (it != data.begin()) @@ -561,14 +561,14 @@ u32 SymbolMap::GetDataStart(u32 address) const return start; } - return -1; + return INVALID_ADDRESS; } u32 SymbolMap::GetDataSize(u32 startAddress) const { auto it = data.find(startAddress); if (it == data.end()) - return -1; + return INVALID_ADDRESS; return it->second.size; } diff --git a/Core/Debugger/SymbolMap.h b/Core/Debugger/SymbolMap.h index 3bcdbd1c23..1ba3a1bd8a 100644 --- a/Core/Debugger/SymbolMap.h +++ b/Core/Debugger/SymbolMap.h @@ -86,6 +86,8 @@ public: u32 GetDataStart(u32 address) const; u32 GetDataSize(u32 startAddress) const; DataType GetDataType(u32 startAddress) const; + + static const u32 INVALID_ADDRESS = (u32)-1; private: void AssignFunctionIndices(); diff --git a/Core/HLE/proAdhoc.cpp b/Core/HLE/proAdhoc.cpp index a8fd0e5d3e..fcf16540e0 100644 --- a/Core/HLE/proAdhoc.cpp +++ b/Core/HLE/proAdhoc.cpp @@ -289,7 +289,7 @@ int friendFinder(){ // BSSID Packet if(rx[0] == OPCODE_CONNECT_BSSID) { // Enough Data available - if(rxpos >= sizeof(SceNetAdhocctlConnectBSSIDPacketS2C)) { + if(rxpos >= (int)sizeof(SceNetAdhocctlConnectBSSIDPacketS2C)) { // Cast Packet SceNetAdhocctlConnectBSSIDPacketS2C * packet = (SceNetAdhocctlConnectBSSIDPacketS2C *)rx; // Update BSSID @@ -310,7 +310,7 @@ int friendFinder(){ // Chat Packet else if(rx[0] == OPCODE_CHAT) { // Enough Data available - if(rxpos >= sizeof(SceNetAdhocctlChatPacketS2C)) { + if(rxpos >= (int)sizeof(SceNetAdhocctlChatPacketS2C)) { // Cast Packet SceNetAdhocctlChatPacketS2C * packet = (SceNetAdhocctlChatPacketS2C *)rx; @@ -331,7 +331,7 @@ int friendFinder(){ // Connect Packet else if(rx[0] == OPCODE_CONNECT) { // Enough Data available - if(rxpos >= sizeof(SceNetAdhocctlConnectPacketS2C)) { + if(rxpos >= (int)sizeof(SceNetAdhocctlConnectPacketS2C)) { // Log Incoming Peer INFO_LOG(SCENET,"Incoming Peer Data..."); @@ -359,7 +359,7 @@ int friendFinder(){ // Disconnect Packet else if(rx[0] == OPCODE_DISCONNECT) { // Enough Data available - if(rxpos >= sizeof(SceNetAdhocctlDisconnectPacketS2C)) { + if(rxpos >= (int)sizeof(SceNetAdhocctlDisconnectPacketS2C)) { // Log Incoming Peer Delete Request INFO_LOG(SCENET,"FriendFinder: Incoming Peer Data Delete Request..."); @@ -387,7 +387,7 @@ int friendFinder(){ // Scan Packet else if(rx[0] == OPCODE_SCAN) { // Enough Data available - if(rxpos >= sizeof(SceNetAdhocctlScanPacketS2C)) { + if(rxpos >= (int)sizeof(SceNetAdhocctlScanPacketS2C)) { // Log Incoming Network Information INFO_LOG(SCENET,"Incoming Group Information..."); // Cast Packet diff --git a/Core/HLE/sceNetAdhoc.cpp b/Core/HLE/sceNetAdhoc.cpp index 5b2de64d44..01f9f05dc1 100644 --- a/Core/HLE/sceNetAdhoc.cpp +++ b/Core/HLE/sceNetAdhoc.cpp @@ -852,7 +852,7 @@ int sceNetAdhocctlTerm() { } // Free sttuf here closesocket(metasocket); - metasocket = INVALID_SOCKET; + metasocket = (int)INVALID_SOCKET; #ifdef _MSC_VER WSACleanup(); #endif @@ -1091,7 +1091,7 @@ int sceNetAdhocPtpOpen(const char *srcmac, int sport, const char *dstmac, int dp // Valid Arguments if(bufsize > 0 && rexmt_int > 0 && rexmt_cnt > 0) { // Create Infrastructure Socket - int tcpsocket = INVALID_SOCKET; + int tcpsocket = (int)INVALID_SOCKET; tcpsocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); // Valid Socket produced diff --git a/Core/MIPS/MIPS.cpp b/Core/MIPS/MIPS.cpp index d21529a6d0..bd9c580fea 100644 --- a/Core/MIPS/MIPS.cpp +++ b/Core/MIPS/MIPS.cpp @@ -151,7 +151,7 @@ MIPSState::MIPSState() 0x6, 0x26, 0x46, 0x66, 0x7, 0x27, 0x47, 0x67, }; - for (int i = 0; i < ARRAY_SIZE(firstThirtyTwo); i++) { + for (int i = 0; i < (int)ARRAY_SIZE(firstThirtyTwo); i++) { if (voffset[firstThirtyTwo[i]] != i) { ERROR_LOG(CPU, "Wrong voffset order! %i: %i should have been %i", firstThirtyTwo[i], voffset[firstThirtyTwo[i]], i); } diff --git a/Windows/Debugger/Debugger_Disasm.cpp b/Windows/Debugger/Debugger_Disasm.cpp index 190b7f8e99..7e5c30947b 100644 --- a/Windows/Debugger/Debugger_Disasm.cpp +++ b/Windows/Debugger/Debugger_Disasm.cpp @@ -186,7 +186,7 @@ void CDisasm::stepInto() } } - for (int i = 0; i < (newAddress-currentPc)/4; i++) + for (u32 i = 0; i < (newAddress-currentPc)/4; i++) { Core_DoSingleStep(); Sleep(1); From eb3011fd18c3d319a7ae6f7f3dcaaed206506f08 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 29 Nov 2013 09:12:00 -0800 Subject: [PATCH 3/6] Don't even define the sse tex hash on non-sse. Avoids unused func warnings. --- GPU/Common/TextureDecoder.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/GPU/Common/TextureDecoder.cpp b/GPU/Common/TextureDecoder.cpp index 4d66ecd1a7..352ed4161d 100644 --- a/GPU/Common/TextureDecoder.cpp +++ b/GPU/Common/TextureDecoder.cpp @@ -24,12 +24,10 @@ #ifdef _M_SSE #include -#endif static u32 QuickTexHashSSE2(const void *checkp, u32 size) { u32 check = 0; -#ifdef _M_SSE if (((intptr_t)checkp & 0xf) == 0 && (size & 0x3f) == 0) { __m128i cursor = _mm_set1_epi32(0); __m128i cursor2 = _mm_set_epi16(0x0001U, 0x0083U, 0x4309U, 0x4d9bU, 0xb651U, 0x4b73U, 0x9bd9U, 0xc00bU); @@ -50,9 +48,6 @@ static u32 QuickTexHashSSE2(const void *checkp, u32 size) { cursor = _mm_add_epi32(cursor, _mm_srli_si128(cursor, 4)); check = _mm_cvtsi128_si32(cursor); } else { -#else - { -#endif const u32 *p = (const u32 *)checkp; for (u32 i = 0; i < size / 8; ++i) { check += *p++; @@ -62,6 +57,7 @@ static u32 QuickTexHashSSE2(const void *checkp, u32 size) { return check; } +#endif static u32 QuickTexHashBasic(const void *checkp, u32 size) { #if defined(ARM) && defined(__GNUC__) @@ -112,7 +108,7 @@ void SetupQuickTexHash() { #ifdef ARMV7 if (cpu_info.bNEON) DoQuickTexHash = &QuickTexHashNEON; -#else +#elif _M_SSE if (cpu_info.bSSE2) DoQuickTexHash = &QuickTexHashSSE2; #endif From 5f2d5d9c558f5bb3feb9ff9f6b94d9d9e6118c0b Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 1 Dec 2013 10:56:10 -0800 Subject: [PATCH 4/6] Fix an uninitialized value warning. --- GPU/GLES/SoftwareTransform.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GPU/GLES/SoftwareTransform.cpp b/GPU/GLES/SoftwareTransform.cpp index d4d16305a5..5c7e167326 100644 --- a/GPU/GLES/SoftwareTransform.cpp +++ b/GPU/GLES/SoftwareTransform.cpp @@ -597,7 +597,7 @@ void TransformDrawEngine::SoftwareTransformAndDraw( drawBuffer = transformedExpanded; TransformedVertex *trans = &transformedExpanded[0]; TransformedVertex saved; - u32 stencilValue; + u32 stencilValue = 0; for (int i = 0; i < vertexCount; i += 2) { int index = ((const u16*)inds)[i]; saved = transformed[index]; From 7de0b28961bcc136becea8326d81a1f987bd84f7 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 1 Dec 2013 11:10:03 -0800 Subject: [PATCH 5/6] Fix an unhandled case value warning. --- Core/Debugger/SymbolMap.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Core/Debugger/SymbolMap.cpp b/Core/Debugger/SymbolMap.cpp index 72790235c1..9848325eda 100644 --- a/Core/Debugger/SymbolMap.cpp +++ b/Core/Debugger/SymbolMap.cpp @@ -119,6 +119,10 @@ bool SymbolMap::LoadSymbolMap(const char *filename) if (name[0] != 0) AddLabel(name,vaddress); break; + case ST_NONE: + case ST_ALL: + // Shouldn't be possible. + break; } } } From df73b8a2a63123ac2b058594ee17940631cd6a8e Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 1 Dec 2013 11:17:24 -0800 Subject: [PATCH 6/6] Omit -Wno-psabi for clang. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d940fe70ba..9980fb9725 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -155,7 +155,7 @@ if(NOT MSVC) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -parallel -fopenmp") endif() if(NOT APPLE) - if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") + if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel" AND NOT CMAKE_C_COMPILER_ID STREQUAL "Clang") add_definitions(-Wno-psabi) endif() add_definitions(-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -D__BSD_VISIBLE=1)