From 43348210f95d5d66ba0bcd5022db4af2c4ec4b7e Mon Sep 17 00:00:00 2001 From: WaluigiWare64 <68647953+WaluigiWare64@users.noreply.github.com> Date: Mon, 25 Jan 2021 14:12:13 +0000 Subject: [PATCH] Fix some compiler warnings --- CMakeLists.txt | 2 +- src/ARMJIT.cpp | 6 +++--- src/ARMJIT_x64/ARMJIT_LoadStore.cpp | 2 +- src/DSi.cpp | 2 +- src/DSi_NWifi.cpp | 4 ++-- src/DSi_SD.cpp | 2 +- src/GPU.cpp | 4 ++-- src/GPU2D_Soft.cpp | 11 +++++++++-- src/GPU3D_OpenGL.cpp | 2 +- src/frontend/qt_sdl/ArchiveUtil.cpp | 2 +- src/frontend/qt_sdl/CheatsDialog.cpp | 4 ++-- src/frontend/qt_sdl/LAN_Socket.cpp | 4 ++-- 12 files changed, 26 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 467e7d6b..a7ac4e6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,4 +122,4 @@ add_subdirectory(src) if (BUILD_QT_SDL) add_subdirectory(src/frontend/qt_sdl) -endif() \ No newline at end of file +endif() diff --git a/src/ARMJIT.cpp b/src/ARMJIT.cpp index bece539f..7e12385e 100644 --- a/src/ARMJIT.cpp +++ b/src/ARMJIT.cpp @@ -26,9 +26,9 @@ #include "NDSCart.h" #include "ARMJIT_x64/ARMJIT_Offsets.h" -static_assert(offsetof(ARM, CPSR) == ARM_CPSR_offset); -static_assert(offsetof(ARM, Cycles) == ARM_Cycles_offset); -static_assert(offsetof(ARM, StopExecution) == ARM_StopExecution_offset); +static_assert(offsetof(ARM, CPSR) == ARM_CPSR_offset, ""); +static_assert(offsetof(ARM, Cycles) == ARM_Cycles_offset, ""); +static_assert(offsetof(ARM, StopExecution) == ARM_StopExecution_offset, ""); namespace ARMJIT { diff --git a/src/ARMJIT_x64/ARMJIT_LoadStore.cpp b/src/ARMJIT_x64/ARMJIT_LoadStore.cpp index c044e69c..65764215 100644 --- a/src/ARMJIT_x64/ARMJIT_LoadStore.cpp +++ b/src/ARMJIT_x64/ARMJIT_LoadStore.cpp @@ -35,7 +35,7 @@ u8* Compiler::RewriteMemAccess(u8* pc) return pc + (ptrdiff_t)patch.Offset; } - printf("this is a JIT bug %llx\n", pc); + printf("this is a JIT bug %sx\n", pc); abort(); } diff --git a/src/DSi.cpp b/src/DSi.cpp index b2bc0919..892437b2 100644 --- a/src/DSi.cpp +++ b/src/DSi.cpp @@ -446,7 +446,7 @@ bool LoadNAND() fread(&ConsoleID, 1, 8, SDMMCFile); printf("eMMC CID: "); printhex(eMMC_CID, 16); - printf("Console ID: %016llX\n", ConsoleID); + printf("Console ID: %016lX\n", ConsoleID); } memset(ITCMInit, 0, 0x8000); diff --git a/src/DSi_NWifi.cpp b/src/DSi_NWifi.cpp index 8b659319..f72e515a 100644 --- a/src/DSi_NWifi.cpp +++ b/src/DSi_NWifi.cpp @@ -187,7 +187,7 @@ void DSi_NWifi::Reset() break; default: - printf("NWifi: unknown hardware type %02X, assuming AR6002\n"); + printf("NWifi: unknown hardware type, assuming AR6002\n"); ROMID = 0x20000188; ChipID = 0x02000001; HostIntAddr = 0x00500400; @@ -691,7 +691,7 @@ void DSi_NWifi::WriteBlock() len = Host->GetTransferrableLen(len); u8 data[0x200]; - if (len = Host->DataTX(data, len)) + if ((len = Host->DataTX(data, len))) { for (u32 i = 0; i < len; i++) { diff --git a/src/DSi_SD.cpp b/src/DSi_SD.cpp index 5b1fd208..8db58c62 100644 --- a/src/DSi_SD.cpp +++ b/src/DSi_SD.cpp @@ -956,7 +956,7 @@ u32 DSi_MMCStorage::WriteBlock(u64 addr) len = Host->GetTransferrableLen(len); u8 data[0x200]; - if (len = Host->DataTX(data, len)) + if ((len = Host->DataTX(data, len))) { if (File) { diff --git a/src/GPU.cpp b/src/GPU.cpp index f490f84c..e2ece10d 100644 --- a/src/GPU.cpp +++ b/src/GPU.cpp @@ -1196,7 +1196,7 @@ NonStupidBitField VRAMTrackingSet> 14)]; @@ -1388,4 +1388,4 @@ bool MakeVRAMFlat_BOBJExtPalCoherent(NonStupidBitField<8*1024/VRAMDirtyGranulari return CopyLinearVRAM<8*1024>(VRAMFlat_BOBJExtPal, &VRAMMap_BOBJExtPal, dirty, ReadVRAM_BOBJExtPal); } -} \ No newline at end of file +} diff --git a/src/GPU2D_Soft.cpp b/src/GPU2D_Soft.cpp index 16d9cab3..f9c27685 100644 --- a/src/GPU2D_Soft.cpp +++ b/src/GPU2D_Soft.cpp @@ -464,7 +464,7 @@ void GPU2D_Soft::DoCapture(u32 line, u32 width) dstaddr &= 0xFFFF; srcBaddr &= 0xFFFF; - static_assert(GPU::VRAMDirtyGranularity == 512); + static_assert(GPU::VRAMDirtyGranularity == 512, ""); GPU::VRAMDirty[dstvram][(dstaddr * 2) / GPU::VRAMDirtyGranularity] = true; switch ((CaptureCnt >> 29) & 0x3) @@ -661,7 +661,10 @@ void GPU2D_Soft::DrawScanlineBGMode(u32 line) } } if ((DispCnt & 0x1000) && NumSprites) + { DoInterleaveSprites(0x40000 | (i<<16)); + } + } } @@ -685,7 +688,9 @@ void GPU2D_Soft::DrawScanlineBGMode6(u32 line) } } if ((DispCnt & 0x1000) && NumSprites) + { DoInterleaveSprites(0x40000 | (i<<16)) + } } } @@ -713,7 +718,9 @@ void GPU2D_Soft::DrawScanlineBGMode7(u32 line) } } if ((DispCnt & 0x1000) && NumSprites) + { DoInterleaveSprites(0x40000 | (i<<16)) + } } } @@ -2037,7 +2044,7 @@ void GPU2D_Soft::DrawSprite_Normal(u32 num, u32 width, u32 height, s32 xpos, s32 if (attrib[1] & 0x1000) // xflip { - pixelsaddr += (width-1 << 1); + pixelsaddr += ((width-1) << 1); pixelsaddr -= (xoff << 1); pixelstride = -2; } diff --git a/src/GPU3D_OpenGL.cpp b/src/GPU3D_OpenGL.cpp index 381af9d6..24c2751c 100644 --- a/src/GPU3D_OpenGL.cpp +++ b/src/GPU3D_OpenGL.cpp @@ -284,7 +284,7 @@ bool Init() glGenBuffers(1, &ShaderConfigUBO); glBindBuffer(GL_UNIFORM_BUFFER, ShaderConfigUBO); - static_assert((sizeof(ShaderConfig) & 15) == 0); + static_assert((sizeof(ShaderConfig) & 15) == 0, ""); glBufferData(GL_UNIFORM_BUFFER, sizeof(ShaderConfig), &ShaderConfig, GL_STATIC_DRAW); glBindBufferBase(GL_UNIFORM_BUFFER, 0, ShaderConfigUBO); diff --git a/src/frontend/qt_sdl/ArchiveUtil.cpp b/src/frontend/qt_sdl/ArchiveUtil.cpp index c1f2fc17..cbb3eccd 100644 --- a/src/frontend/qt_sdl/ArchiveUtil.cpp +++ b/src/frontend/qt_sdl/ArchiveUtil.cpp @@ -82,7 +82,7 @@ QVector ExtractFileFromArchive(const char* path, const char* wantedFile if (bytesRead < 0) { - printf(archive_error_string(a)); + printf("Error whilst reading archive: %s", archive_error_string(a)); return QVector {"Err", archive_error_string(a)}; } diff --git a/src/frontend/qt_sdl/CheatsDialog.cpp b/src/frontend/qt_sdl/CheatsDialog.cpp index 05fedc54..b38c6663 100644 --- a/src/frontend/qt_sdl/CheatsDialog.cpp +++ b/src/frontend/qt_sdl/CheatsDialog.cpp @@ -276,7 +276,7 @@ void CheatsDialog::onCheatEntryModified(QStandardItem* item) if (item->text().isEmpty()) { QString oldname = QString(cat.Name); - item->setText(oldname.isEmpty() ? "(blank category name??)" : oldname); + item->setText(oldname.isEmpty() ? "(blank category name?)" : oldname); } else { @@ -291,7 +291,7 @@ void CheatsDialog::onCheatEntryModified(QStandardItem* item) if (item->text().isEmpty()) { QString oldname = QString(code.Name); - item->setText(oldname.isEmpty() ? "(blank code name??)" : oldname); + item->setText(oldname.isEmpty() ? "(blank code name?)" : oldname); } else { diff --git a/src/frontend/qt_sdl/LAN_Socket.cpp b/src/frontend/qt_sdl/LAN_Socket.cpp index c147e690..6fcac6f9 100644 --- a/src/frontend/qt_sdl/LAN_Socket.cpp +++ b/src/frontend/qt_sdl/LAN_Socket.cpp @@ -102,11 +102,11 @@ ssize_t SlirpCbSendPacket(const void* buf, size_t len, void* opaque) { if (len > 2048) { - printf("slirp: packet too big (%d)\n", len); + printf("slirp: packet too big (%zu)\n", len); return 0; } - printf("slirp: response packet of %d bytes, type %04X\n", len, ntohs(((u16*)buf)[6])); + printf("slirp: response packet of %zu bytes, type %04X\n", len, ntohs(((u16*)buf)[6])); RXEnqueue(buf, len);