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
@@ -183,7 +183,7 @@ bool AlsaSound::AlsaInit()
//it is probably a bad idea to try to send more than one buffer of data
if ((unsigned int)frames_to_deliver > buffer_size)
frames_to_deliver = buffer_size;
NOTICE_LOG(AUDIO, "ALSA gave us a %d sample \"hardware\" buffer with %d periods. Will send %d samples per fragments.\n", buffer_size, periods, frames_to_deliver);
NOTICE_LOG(AUDIO, "ALSA gave us a %ld sample \"hardware\" buffer with %d periods. Will send %d samples per fragments.\n", buffer_size, periods, frames_to_deliver);
snd_pcm_sw_params_alloca(&swparams);
+1 -1
View File
@@ -74,7 +74,7 @@ bool WaveFileWriter::Start(const char *filename)
// We are now at offset 44
if (ftello(file) != 44)
PanicAlert("wrong offset: %i", ftello(file));
PanicAlert("wrong offset: %lli", ftello(file));
return true;
}
+1 -1
View File
@@ -143,7 +143,7 @@ void* DynamicLibrary::Get(const char* funcname) const
if (!library)
{
ERROR_LOG(COMMON, "DL: Get failed %s - Library not loaded");
ERROR_LOG(COMMON, "DL: Get failed %s - Library not loaded", funcname);
return NULL;
}
+1 -1
View File
@@ -337,7 +337,7 @@ u64 GetSize(const char *filename)
// on windows it's actually _stat64 defined in commonFuncs
struct stat64 buf;
if (stat64(filename, &buf) == 0) {
DEBUG_LOG(COMMON, "GetSize: %s: %ld", filename, buf.st_size);
DEBUG_LOG(COMMON, "GetSize: %s: %lld", filename, buf.st_size);
return buf.st_size;
}
+5 -1
View File
@@ -100,7 +100,11 @@ enum LOG_LEVELS {
extern "C" {
#endif
void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type,
const char *file, int line, const char *fmt, ...);
const char *file, int line, const char *fmt, ...)
#ifdef __GNUC__
__attribute__((format(printf, 5, 6)))
#endif
;
#ifdef __cplusplus
};
#endif
+5 -1
View File
@@ -28,7 +28,11 @@ enum MSG_TYPE
typedef bool (*MsgAlertHandler)(const char* caption, const char* text,
bool yes_no, int Style);
void RegisterMsgAlertHandler(MsgAlertHandler handler);
extern bool MsgAlert(const char* caption, bool yes_no, int Style, const char* format, ...);
extern bool MsgAlert(const char* caption, bool yes_no, int Style, const char* format, ...)
#ifdef __GNUC__
__attribute__((format(printf, 4, 5)))
#endif
;
void SetEnableAlert(bool enable);
#ifndef GEKKO
+14 -9
View File
@@ -78,7 +78,8 @@ bool Initialize()
}
char pbuf[100];
err = clGetPlatformInfo(platforms[0], CL_PLATFORM_VENDOR, sizeof(pbuf), pbuf, NULL);
err = clGetPlatformInfo(platforms[0], CL_PLATFORM_VENDOR, sizeof(pbuf),
pbuf, NULL);
if (err != CL_SUCCESS)
{
@@ -95,7 +96,8 @@ bool Initialize()
return false;
}
cl_context_properties cps[3] = {CL_CONTEXT_PLATFORM, (cl_context_properties)platform, 0};
cl_context_properties cps[3] = {CL_CONTEXT_PLATFORM,
(cl_context_properties)platform, 0};
cl_context_properties* cprops = (NULL == platform) ? NULL : cps;
@@ -143,9 +145,10 @@ cl_command_queue GetCommandQueue()
cl_program CompileProgram(const char *Kernel)
{
u32 compileStart = Common::Timer::GetTimeMs();
int err;
cl_int err;
cl_program program;
program = clCreateProgramWithSource(OpenCL::g_context, 1, (const char **) & Kernel, NULL, &err);
program = clCreateProgramWithSource(OpenCL::g_context, 1,
(const char **) & Kernel, NULL, &err);
if (!program)
{
HandleCLError(err, "Error: Failed to create compute program!");
@@ -156,13 +159,14 @@ cl_program CompileProgram(const char *Kernel)
err = clBuildProgram(program , 0, NULL, NULL, NULL, NULL);
if(err != CL_SUCCESS) {
char *errors[16384] = {0};
err = clGetProgramBuildInfo(program, OpenCL::device_id, CL_PROGRAM_BUILD_LOG, sizeof(errors),
errors, NULL);
ERROR_LOG(COMMON, "Error log:\n%s\n", errors);
err = clGetProgramBuildInfo(program, OpenCL::device_id,
CL_PROGRAM_BUILD_LOG, sizeof(*errors), errors, NULL);
ERROR_LOG(COMMON, "Error log:\n%s\n", *errors);
return NULL;
}
NOTICE_LOG(COMMON, "OpenCL CompileProgram took %.3f seconds", (float)(Common::Timer::GetTimeMs() - compileStart) / 1000.0);
NOTICE_LOG(COMMON, "OpenCL CompileProgram took %.3f seconds",
(float)(Common::Timer::GetTimeMs() - compileStart) / 1000.0);
return program;
}
@@ -180,7 +184,8 @@ cl_kernel CompileKernel(cl_program program, const char *Function)
HandleCLError(err, buffer);
return NULL;
}
NOTICE_LOG(COMMON, "OpenCL CompileKernel took %.3f seconds", (float)(Common::Timer::GetTimeMs() - compileStart) / 1000.0);
NOTICE_LOG(COMMON, "OpenCL CompileKernel took %.3f seconds",
(float)(Common::Timer::GetTimeMs() - compileStart) / 1000.0);
return kernel;
}
#endif
+1 -1
View File
@@ -196,7 +196,7 @@ bool SDCardCreate(u64 disk_size /*in MB*/, char* filename)
disk_size *= 1024 * 1024;
if (disk_size < 0x800000 || disk_size > 0x800000000ULL) {
ERROR_LOG(COMMON, "Trying to create SD Card image of size %iMB is out of range (8MB-32GB)", disk_size/(1024*1024));
ERROR_LOG(COMMON, "Trying to create SD Card image of size %lliMB is out of range (8MB-32GB)", disk_size/(1024*1024));
return false;
}
+1 -1
View File
@@ -47,7 +47,7 @@ bool SysConf::LoadFromFile(const char *filename)
return false; //most likely: file does not exist
if (size != SYSCONF_SIZE)
{
PanicAlert("Your SYSCONF file is the wrong size - should be 0x%04x (but is 0x%04x)",
PanicAlert("Your SYSCONF file is the wrong size - should be 0x%04x (but is 0x%04llx)",
SYSCONF_SIZE, size);
return false;
}
+2 -2
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;
+2 -2
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);
}
+4 -2
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;
@@ -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;
@@ -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);
}
}
+3 -3
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;
+1 -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);
@@ -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;
@@ -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;
+2 -2
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));
}
}
@@ -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;
}

Some files were not shown because too many files have changed in this diff Show More