Use __attribute__(format) magic

This commit is contained in:
Michael Spang 2009-01-31 01:12:37 -05:00
parent 54658af34a
commit ddecf4a4a0
1 changed files with 13 additions and 10 deletions

View File

@ -7,8 +7,10 @@
#ifdef __GNUC__
#define NORETURN __attribute__((__noreturn__))
#define PRINTF_LIKE(extra) __attribute__((format(printf, extra+1, extra+2)))
#else
#define NORETURN
#define PRINTF_LIKE(extra)
#endif
#ifndef LOG_AUTHPRIV
@ -18,16 +20,17 @@
int spawnv(const char *path, char *const *argv);
void init_log(const char *ident, int option, int facility);
NORETURN void fatal(const char *, ...);
NORETURN void fatalpe(const char *, ...);
NORETURN void badconf(const char *, ...);
NORETURN void deny(const char *, ...);
void error(const char *, ...);
void warn(const char *, ...);
void notice(const char *, ...);
void errorpe(const char *, ...);
void warnpe(const char *, ...);
void logmsg(int, const char *, ...);
PRINTF_LIKE(0) NORETURN void fatal(const char *, ...);
PRINTF_LIKE(0) NORETURN void fatalpe(const char *, ...);
PRINTF_LIKE(0) NORETURN void badconf(const char *, ...);
PRINTF_LIKE(0) NORETURN void deny(const char *, ...);
PRINTF_LIKE(0) void error(const char *, ...);
PRINTF_LIKE(0) void warn(const char *, ...);
PRINTF_LIKE(0) void notice(const char *, ...);
PRINTF_LIKE(0) void debug(const char *, ...);
PRINTF_LIKE(0) void errorpe(const char *, ...);
PRINTF_LIKE(0) void warnpe(const char *, ...);
PRINTF_LIKE(1) void logmsg(int priority, const char *, ...);
static inline void *xmalloc(size_t size) {
void *alloc = malloc(size);