mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-25 07:09:48 -06:00
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:
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user