allow gcc to check the format of args being passed to MsgAlert and GenericLog. Fixed nearly all warnings that arose from this, as well as some preexisting ones (some were actually crashes and/or bugs...)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6522 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman
2010-12-05 09:04:34 +00:00
parent 3e4aa20601
commit 9da4fe086b
35 changed files with 88 additions and 71 deletions

View File

@ -245,7 +245,7 @@ void LogInfo(const char *format, ...)
va_start(args, format);
CharArrayFromFormatV(temp, 512, format, args);
va_end(args);
INFO_LOG(ACTIONREPLAY, temp);
INFO_LOG(ACTIONREPLAY, "%s", temp);
if (logSelf)
{
@ -798,7 +798,7 @@ bool ZeroCode_MemoryCopy(const u32 val_last, const ARAddr addr, const u32 data)
else
{
LogInfo("Bad Value");
PanicAlert("Action Replay Error: Invalid value (&08x) in Memory Copy (%s)", (data & ~0x7FFF), current_code->name.c_str());
PanicAlert("Action Replay Error: Invalid value (%08x) in Memory Copy (%s)", (data & ~0x7FFF), current_code->name.c_str());
return false;
}
return true;

View File

@ -689,7 +689,7 @@ bool report_slow(int skipped)
// WARNING - THIS IS EXECUTED FROM VIDEO THREAD
void Callback_VideoLog(const TCHAR *_szMessage, int _bDoBreak)
{
INFO_LOG(VIDEO, _szMessage);
INFO_LOG(VIDEO, "%s", _szMessage);
}
// Should be called from GPU thread when a frame is drawn
@ -710,7 +710,7 @@ void Callback_VideoRequestWindowSize(int& x, int& y, int& width, int& height)
// WARNING - THIS MAY BE EXECUTED FROM DSP THREAD
void Callback_DSPLog(const TCHAR* _szMessage, int _v)
{
GENERIC_LOG(LogTypes::AUDIO, (LogTypes::LOG_LEVELS)_v, _szMessage);
GENERIC_LOG(LogTypes::AUDIO, (LogTypes::LOG_LEVELS)_v, "%s", _szMessage);
}

View File

@ -529,8 +529,10 @@ void ExecuteCommand(UDICR& _DICR)
if (GCAM)
{
ERROR_LOG(DVDINTERFACE, "DVD: %08x, %08x, %08x, DMA=addr:%08x,len:%08x,ctrl:%08x",
m_DICMDBUF[0], m_DICMDBUF[1], m_DICMDBUF[2], m_DIMAR, m_DILENGTH, m_DICR);
ERROR_LOG(DVDINTERFACE,
"DVD: %08x, %08x, %08x, DMA=addr:%08x,len:%08x,ctrl:%08x",
m_DICMDBUF[0].Hex, m_DICMDBUF[1].Hex, m_DICMDBUF[2].Hex,
m_DIMAR.Hex, m_DILENGTH.Hex, m_DICR.Hex);
// decrypt command. But we have a zero key, that simplifies things a lot.
// If you get crazy dvd command errors, make sure 0x80000000 - 0x8000000c is zero'd
m_DICMDBUF[0].Hex <<= 24;

View File

@ -831,7 +831,7 @@ void Wiimote::InterruptChannel(const u16 _channelID, const void* _pData, u32 _Si
break;
default :
PanicAlert("HidInput: HID_TYPE_DATA - param 0x%02x", hidp->type, hidp->param);
PanicAlert("HidInput: HID_TYPE_DATA - param 0x%02x", hidp->param);
break;
}
break;

View File

@ -214,13 +214,13 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
const char *pFilename = m_pFileSystem->GetFileName(DVDAddress);
if (pFilename != NULL)
{
INFO_LOG(WII_IPC_DVD, "DVDLowRead: %s (0x%x) - (DVDAddr: 0x%x, Size: 0x%x)",
INFO_LOG(WII_IPC_DVD, "DVDLowRead: %s (0x%llx) - (DVDAddr: 0x%llx, Size: 0x%x)",
pFilename, m_pFileSystem->GetFileSize(pFilename), DVDAddress, Size);
FileMon::CheckFile(std::string(pFilename), (int)m_pFileSystem->GetFileSize(pFilename));
}
else
{
INFO_LOG(WII_IPC_DVD, "DVDLowRead: file unkw - (DVDAddr: 0x%x, Size: 0x%x)",
INFO_LOG(WII_IPC_DVD, "DVDLowRead: file unkw - (DVDAddr: 0x%llx, Size: 0x%x)",
DVDAddress, Size);
}
@ -315,9 +315,9 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
return 2;
}
u64 DVDAddress = (u64)(DVDAddress32 << 2);
u64 DVDAddress = (u64)DVDAddress32 << 2;
INFO_LOG(WII_IPC_DVD, "DVDLowUnencryptedRead: DVDAddr: 0x%08x, Size: 0x%x", DVDAddress, Size);
INFO_LOG(WII_IPC_DVD, "DVDLowUnencryptedRead: DVDAddr: 0x%08llx, Size: 0x%x", DVDAddress, Size);
if (Size > _BufferOutSize)
{
@ -350,12 +350,12 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
const char *pFilename = m_pFileSystem->GetFileName(DVDAddress);
if (pFilename != NULL)
{
INFO_LOG(WII_IPC_DVD, "DVDLowSeek: %s (0x%x) - (DVDAddr: 0x%x)",
INFO_LOG(WII_IPC_DVD, "DVDLowSeek: %s (0x%llx) - (DVDAddr: 0x%llx)",
pFilename, m_pFileSystem->GetFileSize(pFilename), DVDAddress);
}
else
{
INFO_LOG(WII_IPC_DVD, "DVDLowSeek: file unkw - (DVDAddr: 0x%x)",
INFO_LOG(WII_IPC_DVD, "DVDLowSeek: file unkw - (DVDAddr: 0x%llx)",
DVDAddress);
}
}

View File

@ -425,11 +425,11 @@ static int doPopup(lua_State* L, const char* deftype, const char* deficon)
const char* answer = "ok";
if(itype == 1)
answer = PanicYesNo(str) ? "yes" : "no";
answer = PanicYesNo("%s", str) ? "yes" : "no";
else if(iicon == 1)
SuccessAlert(str);
SuccessAlert("%s", str);
else
PanicAlert(str);
PanicAlert("%s", str);
lua_pushstring(L, answer);
return 1;

View File

@ -211,7 +211,7 @@ void sigsegv_handler(int signal, siginfo_t *info, void *raw_context)
u64 bad_address = (u64)fault_memory_ptr;
u64 memspace_bottom = (u64)Memory::base;
if (bad_address < memspace_bottom) {
PanicAlert("Exception handler - access below memory space. %08x%08x",
PanicAlert("Exception handler - access below memory space. %08llx%08llx",
bad_address >> 32, bad_address);
}
u32 em_address = (u32)(bad_address - memspace_bottom);

View File

@ -88,7 +88,7 @@ void FPSCRtoFPUSettings(UReg_FPSCR fp)
FPU_ROUND_DOWN
};
unsigned short mode;
asm ("fstcw %0" : : "m" (mode));
asm ("fstcw %0" : "=m" (mode) : );
mode = (mode & ~FPU_ROUND_MASK) | table[fp.RN];
asm ("fldcw %0" : : "m" (mode));
#endif
@ -383,7 +383,7 @@ void Interpreter::mtspr(UGeckoInstruction _inst)
break;
case SPR_WPAR:
_assert_msg_(POWERPC, m_GPR[_inst.RD] == 0x0C008000, "Gather pipe @ %08x");
_assert_msg_(POWERPC, m_GPR[_inst.RD] == 0x0C008000, "Gather pipe @ %08x", PC);
GPFifo::ResetGatherPipe();
break;

View File

@ -80,7 +80,7 @@ void RegCache::Lock(int p1, int p2, int p3, int p4)
void RegCache::LockX(int x1, int x2, int x3, int x4)
{
if (xlocks[x1]) {
PanicAlert("RegCache: x %i already locked!");
PanicAlert("RegCache: x %i already locked!", x1);
}
xlocks[x1] = true;
if (x2 != 0xFF) xlocks[x2] = true;

View File

@ -1325,7 +1325,7 @@ void IRBuilder::WriteToFile(u64 codeHash) {
if (isImm(*inst)) {
fprintf(file, " 0x%08x", GetImmValue(inst));
} else {
fprintf(file, " %10lu", i - (I - inst));
fprintf(file, " %10u", i - (I - inst));
}
}
@ -1335,7 +1335,7 @@ void IRBuilder::WriteToFile(u64 codeHash) {
if (isImm(*inst)) {
fprintf(file, " 0x%08x", GetImmValue(inst));
} else {
fprintf(file, " %10lu", i - (I - inst));
fprintf(file, " %10u", i - (I - inst));
}
}

View File

@ -51,8 +51,8 @@ void BackPatchError(const std::string &text, u8 *codePtr, u32 emAddress) {
#endif
PanicAlert("%s\n\n"
"Error encountered accessing emulated address %08x.\n"
"Culprit instruction: \n%s\nat %08x%08x",
text.c_str(), emAddress, disbuf, code_addr>>32, code_addr);
"Culprit instruction: \n%s\nat %#llx",
text.c_str(), emAddress, disbuf, code_addr);
return;
}

View File

@ -341,7 +341,7 @@ void LoadStateCallback(u64 userdata, int cyclesLate)
if (res != LZO_E_OK)
{
// This doesn't seem to happen anymore.
PanicAlert("Internal LZO Error - decompression failed (%d) (%d, %d) \n"
PanicAlert("Internal LZO Error - decompression failed (%d) (%li, %li) \n"
"Try loading the state again", res, i, new_len);
fclose(f);
delete[] buffer;
@ -440,7 +440,7 @@ void VerifyStateCallback(u64 userdata, int cyclesLate)
if (res != LZO_E_OK)
{
// This doesn't seem to happen anymore.
PanicAlert("Internal LZO Error - decompression failed (%d) (%d, %d) \n"
PanicAlert("Internal LZO Error - decompression failed (%d) (%ld, %ld) \n"
"Try verifying the state again", res, i, new_len);
fclose(f);
delete [] buffer;