mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge pull request #15227 from unknownbrackets/warnings
Fix some warnings
This commit is contained in:
commit
c6731d9d07
13 changed files with 63 additions and 37 deletions
|
@ -13,7 +13,8 @@ enable_language(ASM)
|
|||
|
||||
add_definitions(-D__STDC_CONSTANT_MACROS)
|
||||
|
||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
|
||||
# Include AppleClang and Clang.
|
||||
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
||||
set(CLANG ON)
|
||||
message("Clang enabled")
|
||||
endif()
|
||||
|
@ -306,7 +307,9 @@ if(NOT MSVC)
|
|||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
|
||||
endif()
|
||||
if(CLANG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch -Wno-uninitialized")
|
||||
add_definitions(-Wno-nullability-completeness)
|
||||
add_definitions(-Wno-tautological-pointer-compare)
|
||||
add_definitions(-Wno-deprecated-register)
|
||||
endif()
|
||||
|
||||
if(USE_ASAN)
|
||||
|
@ -340,8 +343,6 @@ if(NOT MSVC)
|
|||
|
||||
# Disable some warnings
|
||||
add_definitions(-Wno-multichar)
|
||||
add_definitions(-Wno-deprecated-register)
|
||||
add_definitions(-Wno-tautological-pointer-compare)
|
||||
|
||||
# Don't compile with strict aliasing, we're not 100% aliasing-safe
|
||||
add_compile_options(-fno-strict-aliasing)
|
||||
|
@ -361,7 +362,7 @@ if(NOT MSVC)
|
|||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
||||
elseif(NOT ANDROID)
|
||||
# TODO: See if we can get rid of no-psabi
|
||||
if(NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Intel" AND NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
|
||||
if(NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Intel" AND NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
||||
add_definitions(-Wno-psabi)
|
||||
endif()
|
||||
add_definitions(-D_XOPEN_SOURCE=700)
|
||||
|
|
|
@ -55,7 +55,7 @@ struct ShaderLanguageDesc {
|
|||
bool bitwiseOps = false;
|
||||
bool forceMatrix4x4 = false;
|
||||
bool coefsFromBuffers = false;
|
||||
char driverInfo[128]; // Really only GL uses this.
|
||||
char driverInfo[256]; // Really only GL uses this.
|
||||
};
|
||||
|
||||
enum class UniformType : int8_t {
|
||||
|
|
|
@ -14,7 +14,7 @@ typedef enum {
|
|||
|
||||
typedef enum { EXCOMM_CONST, EXCOMM_CONST_FLOAT, EXCOMM_REF, EXCOMM_OP } ExpressionCommand;
|
||||
|
||||
static char expressionError[256];
|
||||
static char expressionError[512];
|
||||
|
||||
typedef struct {
|
||||
char Name[4];
|
||||
|
|
|
@ -66,24 +66,22 @@ void sleep_ms(int ms) {
|
|||
|
||||
// Return the current time formatted as Minutes:Seconds:Milliseconds
|
||||
// in the form 00:00:000.
|
||||
void GetTimeFormatted(char formattedTime[13]) {
|
||||
void GetTimeFormatted(char formattedTime[11]) {
|
||||
time_t sysTime;
|
||||
struct tm * gmTime;
|
||||
char tmp[13];
|
||||
|
||||
time(&sysTime);
|
||||
gmTime = localtime(&sysTime);
|
||||
|
||||
strftime(tmp, 6, "%M:%S", gmTime);
|
||||
struct tm *gmTime = localtime(&sysTime);
|
||||
char tmp[6];
|
||||
strftime(tmp, sizeof(tmp), "%M:%S", gmTime);
|
||||
|
||||
// Now tack on the milliseconds
|
||||
#ifdef _WIN32
|
||||
struct timeb tp;
|
||||
(void)::ftime(&tp);
|
||||
snprintf(formattedTime, 13, "%s:%03i", tmp, tp.millitm);
|
||||
snprintf(formattedTime, 11, "%s:%03i", tmp, tp.millitm);
|
||||
#else
|
||||
struct timeval t;
|
||||
(void)gettimeofday(&t, NULL);
|
||||
snprintf(formattedTime, 13, "%s:%03d", tmp, (int)(t.tv_usec / 1000));
|
||||
snprintf(formattedTime, 11, "%s:%03d", tmp, (int)(t.tv_usec / 1000));
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ static void CleanupDialogThreads(bool force = false) {
|
|||
accessThread = nullptr;
|
||||
accessThreadState = "cleaned up";
|
||||
} else if (force) {
|
||||
ERROR_LOG_REPORT(SCEUTILITY, "Utility access thread still running, state: %s, dialog=%d/%d", accessThreadState, currentDialogType, currentDialogActive);
|
||||
ERROR_LOG_REPORT(SCEUTILITY, "Utility access thread still running, state: %s, dialog=%d/%d", accessThreadState, (int)currentDialogType, currentDialogActive);
|
||||
|
||||
// Try to force shutdown anyway.
|
||||
accessThread->Terminate();
|
||||
|
|
|
@ -365,22 +365,27 @@ namespace MIPSDis
|
|||
void Dis_Emuhack(MIPSOpcode op, char *out)
|
||||
{
|
||||
auto resolved = Memory::Read_Instruction(disPC, true);
|
||||
char disasm[256];
|
||||
union {
|
||||
char disasm[256];
|
||||
char truncated[241];
|
||||
};
|
||||
if (MIPS_IS_EMUHACK(resolved)) {
|
||||
strcpy(disasm, "(invalid emuhack)");
|
||||
} else {
|
||||
MIPSDisAsm(resolved, disPC, disasm, true);
|
||||
}
|
||||
|
||||
// Truncate in case it was too long, just to avoid warnings.
|
||||
truncated[240] = '\0';
|
||||
switch (op.encoding >> 24) {
|
||||
case 0x68:
|
||||
snprintf(out, 256, "* jitblock: %s", disasm);
|
||||
snprintf(out, 256, "* jitblock: %s", truncated);
|
||||
break;
|
||||
case 0x6a:
|
||||
snprintf(out, 256, "* replacement: %s", disasm);
|
||||
snprintf(out, 256, "* replacement: %s", truncated);
|
||||
break;
|
||||
default:
|
||||
snprintf(out, 256, "* (invalid): %s", disasm);
|
||||
snprintf(out, 256, "* (invalid): %s", truncated);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -206,7 +206,7 @@ static const char *GetSystemRegName(int o0, int op1, int CRn, int CRm, int op2)
|
|||
}
|
||||
|
||||
static void BranchExceptionAndSystem(uint32_t w, uint64_t addr, Instruction *instr, SymbolCallback symbolCallback) {
|
||||
char buffer[128];
|
||||
char buffer[125];
|
||||
int Rt = w & 0x1f;
|
||||
int Rn = (w >> 5) & 0x1f;
|
||||
if (((w >> 26) & 0x1F) == 5) {
|
||||
|
|
|
@ -340,7 +340,7 @@ bool PortManager::Clear() {
|
|||
#ifdef WITH_UPNP
|
||||
int r;
|
||||
int i = 0;
|
||||
char index[6];
|
||||
char index[16];
|
||||
char intAddr[40];
|
||||
char intPort[6];
|
||||
char extPort[6];
|
||||
|
@ -359,7 +359,7 @@ bool PortManager::Clear() {
|
|||
//unsigned int num = 0;
|
||||
//UPNP_GetPortMappingNumberOfEntries(urls->controlURL, datas->first.servicetype, &num); // Not supported by many routers
|
||||
do {
|
||||
snprintf(index, 6, "%d", i);
|
||||
snprintf(index, sizeof(index), "%d", i);
|
||||
rHost[0] = '\0'; enabled[0] = '\0';
|
||||
duration[0] = '\0'; desc[0] = '\0'; protocol[0] = '\0';
|
||||
extPort[0] = '\0'; intPort[0] = '\0'; intAddr[0] = '\0';
|
||||
|
@ -387,7 +387,7 @@ bool PortManager::Clear() {
|
|||
}
|
||||
}
|
||||
i++;
|
||||
} while (r == 0);
|
||||
} while (r == 0 && i < 65536);
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
|
@ -398,7 +398,7 @@ bool PortManager::RefreshPortList() {
|
|||
#ifdef WITH_UPNP
|
||||
int r;
|
||||
int i = 0;
|
||||
char index[6];
|
||||
char index[16];
|
||||
char intAddr[40];
|
||||
char intPort[6];
|
||||
char extPort[6];
|
||||
|
@ -419,7 +419,7 @@ bool PortManager::RefreshPortList() {
|
|||
//unsigned int num = 0;
|
||||
//UPNP_GetPortMappingNumberOfEntries(urls->controlURL, datas->first.servicetype, &num); // Not supported by many routers
|
||||
do {
|
||||
snprintf(index, 6, "%d", i);
|
||||
snprintf(index, sizeof(index), "%d", i);
|
||||
rHost[0] = '\0'; enabled[0] = '\0';
|
||||
duration[0] = '\0'; desc[0] = '\0'; protocol[0] = '\0';
|
||||
extPort[0] = '\0'; intPort[0] = '\0'; intAddr[0] = '\0';
|
||||
|
@ -444,7 +444,7 @@ bool PortManager::RefreshPortList() {
|
|||
}
|
||||
}
|
||||
i++;
|
||||
} while (r == 0);
|
||||
} while (r == 0 && i < 65536);
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
|
|
|
@ -28,6 +28,13 @@
|
|||
|
||||
namespace Rasterizer {
|
||||
|
||||
// Our std::unordered_map argument will ignore the alignment attribute, but that doesn't matter.
|
||||
// We'll still have and want it for the actual function call, to keep the args in vector registers.
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wignored-attributes"
|
||||
#endif
|
||||
|
||||
typedef void (SOFTRAST_CALL *SingleFunc)(int x, int y, int z, int fog, Vec4IntArg color_in, const PixelFuncID &pixelID);
|
||||
SingleFunc GetSingleFunc(const PixelFuncID &id);
|
||||
|
||||
|
@ -110,4 +117,8 @@ private:
|
|||
#endif
|
||||
};
|
||||
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
};
|
||||
|
|
|
@ -1291,14 +1291,14 @@ bool PixelJitCache::Jit_DstBlendFactor(const PixelFuncID &id, RegCache::Reg srcF
|
|||
PSUBUSW(dstFactorReg, R(argColorReg));
|
||||
break;
|
||||
|
||||
case GE_SRCBLEND_SRCALPHA:
|
||||
case GE_SRCBLEND_INVSRCALPHA:
|
||||
case GE_SRCBLEND_DSTALPHA:
|
||||
case GE_SRCBLEND_INVDSTALPHA:
|
||||
case GE_SRCBLEND_DOUBLESRCALPHA:
|
||||
case GE_SRCBLEND_DOUBLEINVSRCALPHA:
|
||||
case GE_SRCBLEND_DOUBLEDSTALPHA:
|
||||
case GE_SRCBLEND_DOUBLEINVDSTALPHA:
|
||||
case GE_DSTBLEND_SRCALPHA:
|
||||
case GE_DSTBLEND_INVSRCALPHA:
|
||||
case GE_DSTBLEND_DSTALPHA:
|
||||
case GE_DSTBLEND_INVDSTALPHA:
|
||||
case GE_DSTBLEND_DOUBLESRCALPHA:
|
||||
case GE_DSTBLEND_DOUBLEINVSRCALPHA:
|
||||
case GE_DSTBLEND_DOUBLEDSTALPHA:
|
||||
case GE_DSTBLEND_DOUBLEINVDSTALPHA:
|
||||
// These are all equivalent for src factor, so reuse that logic.
|
||||
if (id.AlphaBlendSrc() == GEBlendSrcFactor(id.AlphaBlendDst())) {
|
||||
MOVDQA(dstFactorReg, R(srcFactorReg));
|
||||
|
|
|
@ -26,6 +26,13 @@
|
|||
|
||||
namespace Sampler {
|
||||
|
||||
// Our std::unordered_map argument will ignore the alignment attribute, but that doesn't matter.
|
||||
// We'll still have and want it for the actual function call, to keep the args in vector registers.
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wignored-attributes"
|
||||
#endif
|
||||
|
||||
typedef Rasterizer::Vec4IntResult (SOFTRAST_CALL *NearestFunc)(int u, int v, const u8 *tptr, int bufw, int level);
|
||||
NearestFunc GetNearestFunc();
|
||||
|
||||
|
@ -87,4 +94,8 @@ private:
|
|||
Rasterizer::RegCache regCache_;
|
||||
};
|
||||
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
};
|
||||
|
|
|
@ -809,7 +809,7 @@ void TouchTestScreen::render() {
|
|||
|
||||
ui_context->Begin();
|
||||
|
||||
char buffer[2048];
|
||||
char buffer[4096];
|
||||
for (int i = 0; i < MAX_TOUCH_POINTS; i++) {
|
||||
if (touches_[i].id != -1) {
|
||||
ui_context->Draw()->Circle(touches_[i].x, touches_[i].y, 100.0, 3.0, 80, 0.0f, 0xFFFFFFFF, 1.0);
|
||||
|
|
|
@ -422,7 +422,7 @@ static bool DisasmNeonImmVal(uint32_t op, char *text) {
|
|||
int quad = (op >> 6) & 1;
|
||||
const char *operation = "MOV";
|
||||
const char *size = "(unk)";
|
||||
char temp[256] = "(unk)";
|
||||
char temp[64] = "(unk)";
|
||||
switch (cmode) {
|
||||
case VIMM___x___x:
|
||||
case VIMM___x___x + 1:
|
||||
|
|
Loading…
Add table
Reference in a new issue