Mark log functions as printf-type functions.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2344 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -154,5 +154,22 @@ typedef unsigned int wint_t;
|
||||
# define SDL_IMAGE_INCLUDE(file) <file>
|
||||
#endif /* SDL_IMAGE_DIR */
|
||||
|
||||
// Mark a function as using printf-style function arguments, so that
|
||||
// extra consistency checks can be made by the compiler.
|
||||
// The first argument to PRINTF_FUNCTION and VPRINTF_FUNCTION is the
|
||||
// index of the format string argument, the second is the index of
|
||||
// the first argument which is specified in the format string (in the
|
||||
// case of PRINTF_FUNCTION) or of the va_list argument (in the case of
|
||||
// VPRINTF_FUNCTION).
|
||||
#ifdef __GNUC__
|
||||
# define PRINTF_FUNCTION(formatArg, firstArg) \
|
||||
__attribute__((format(printf, formatArg, firstArg)))
|
||||
# define VPRINTF_FUNCTION(formatArg, arglist) \
|
||||
__attribute__((format(printf, formatArg, 0)))
|
||||
#else
|
||||
# define PRINTF_FUNCTION(formatArg, firstArg)
|
||||
# define VPRINTF_FUNCTION(formatArg, arglist)
|
||||
#endif
|
||||
|
||||
#endif /* _PORT_H */
|
||||
|
||||
|
||||
@@ -44,10 +44,14 @@ typedef enum
|
||||
|
||||
} log_Level;
|
||||
|
||||
extern void log_add (log_Level, const char *fmt, ...);
|
||||
extern void log_addV (log_Level, const char *fmt, va_list);
|
||||
extern void log_add_nothread (log_Level, const char *fmt, ...);
|
||||
extern void log_add_nothreadV (log_Level, const char *fmt, va_list);
|
||||
extern void log_add (log_Level, const char *fmt, ...)
|
||||
PRINTF_FUNCTION(2, 3);
|
||||
extern void log_addV (log_Level, const char *fmt, va_list)
|
||||
VPRINTF_FUNCTION(2, 3);
|
||||
extern void log_add_nothread (log_Level, const char *fmt, ...)
|
||||
PRINTF_FUNCTION(2, 3);
|
||||
extern void log_add_nothreadV (log_Level, const char *fmt, va_list)
|
||||
VPRINTF_FUNCTION(2, 3);
|
||||
|
||||
|
||||
#endif /* _UQMLOG_H */
|
||||
|
||||
Reference in New Issue
Block a user