log.h: tell the compiler these logging functions use printf-like formats

This gives us additional warnings and is supported in gcc and clang.
This commit is contained in:
Michael Stapelberg 2012-08-05 15:59:08 +02:00
parent d5b7146123
commit 991a9de0d7
1 changed files with 6 additions and 3 deletions

View File

@ -49,20 +49,23 @@ void set_verbosity(bool _verbose);
* but only if debug logging was activated. * but only if debug logging was activated.
* *
*/ */
void debuglog(char *fmt, ...); void debuglog(char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
/** /**
* Logs the given message to stdout while prefixing the current time to it. * Logs the given message to stdout while prefixing the current time to it.
* *
*/ */
void errorlog(char *fmt, ...); void errorlog(char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
/** /**
* Logs the given message to stdout while prefixing the current time to it, * Logs the given message to stdout while prefixing the current time to it,
* but only if verbose mode is activated. * but only if verbose mode is activated.
* *
*/ */
void verboselog(char *fmt, ...); void verboselog(char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
/** /**
* Logs the given message to stdout while prefixing the current time to it. * Logs the given message to stdout while prefixing the current time to it.