forked from public/pyceo
Use __attribute__(format) magic
This commit is contained in:
parent
54658af34a
commit
ddecf4a4a0
23
src/util.h
23
src/util.h
|
@ -7,8 +7,10 @@
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define NORETURN __attribute__((__noreturn__))
|
#define NORETURN __attribute__((__noreturn__))
|
||||||
|
#define PRINTF_LIKE(extra) __attribute__((format(printf, extra+1, extra+2)))
|
||||||
#else
|
#else
|
||||||
#define NORETURN
|
#define NORETURN
|
||||||
|
#define PRINTF_LIKE(extra)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef LOG_AUTHPRIV
|
#ifndef LOG_AUTHPRIV
|
||||||
|
@ -18,16 +20,17 @@
|
||||||
int spawnv(const char *path, char *const *argv);
|
int spawnv(const char *path, char *const *argv);
|
||||||
void init_log(const char *ident, int option, int facility);
|
void init_log(const char *ident, int option, int facility);
|
||||||
|
|
||||||
NORETURN void fatal(const char *, ...);
|
PRINTF_LIKE(0) NORETURN void fatal(const char *, ...);
|
||||||
NORETURN void fatalpe(const char *, ...);
|
PRINTF_LIKE(0) NORETURN void fatalpe(const char *, ...);
|
||||||
NORETURN void badconf(const char *, ...);
|
PRINTF_LIKE(0) NORETURN void badconf(const char *, ...);
|
||||||
NORETURN void deny(const char *, ...);
|
PRINTF_LIKE(0) NORETURN void deny(const char *, ...);
|
||||||
void error(const char *, ...);
|
PRINTF_LIKE(0) void error(const char *, ...);
|
||||||
void warn(const char *, ...);
|
PRINTF_LIKE(0) void warn(const char *, ...);
|
||||||
void notice(const char *, ...);
|
PRINTF_LIKE(0) void notice(const char *, ...);
|
||||||
void errorpe(const char *, ...);
|
PRINTF_LIKE(0) void debug(const char *, ...);
|
||||||
void warnpe(const char *, ...);
|
PRINTF_LIKE(0) void errorpe(const char *, ...);
|
||||||
void logmsg(int, 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) {
|
static inline void *xmalloc(size_t size) {
|
||||||
void *alloc = malloc(size);
|
void *alloc = malloc(size);
|
||||||
|
|
Loading…
Reference in New Issue