mirror of
https://github.com/mupen64plus/mupen64plus-ui-console.git
synced 2025-04-02 10:52:34 -04:00
add function attributes so GCC can find bugs in calls to string formatting functions with variadic arguments
This commit is contained in:
parent
8f7b6b07ca
commit
b8fa2dea54
2 changed files with 9 additions and 2 deletions
|
@ -159,8 +159,9 @@ static void FrameCallback(unsigned int FrameIndex)
|
|||
}
|
||||
}
|
||||
|
||||
static char *formatstr(const char *fmt, ...) ATTR_FMT(1, 2);
|
||||
|
||||
static char *formatstr(const char *fmt, ...)
|
||||
char *formatstr(const char *fmt, ...)
|
||||
{
|
||||
int size = 128, ret;
|
||||
char *str = (char *)malloc(size), *newstr;
|
||||
|
|
|
@ -22,7 +22,13 @@
|
|||
#ifndef __MAIN_H__
|
||||
#define __MAIN_H__
|
||||
|
||||
extern void DebugMessage(int level, const char *message, ...);
|
||||
#if defined(__GNUC__)
|
||||
#define ATTR_FMT(fmtpos, attrpos) __attribute__ ((format (printf, fmtpos, attrpos)))
|
||||
#else
|
||||
#define ATTR_FMT(fmtpos, attrpos)
|
||||
#endif
|
||||
|
||||
extern void DebugMessage(int level, const char *message, ...) ATTR_FMT(2,3);
|
||||
extern void DebugCallback(void *Context, int level, const char *message);
|
||||
|
||||
extern int g_Verbose;
|
||||
|
|
Loading…
Add table
Reference in a new issue