From 2995c5954980f84b0e4a5501dbdde92ec57293ca Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 7 Mar 2012 11:00:02 -0500 Subject: libsandbox: create more defines for gcc attributes Signed-off-by: Mike Frysinger --- libsandbox/libsandbox.h | 4 ++-- libsbutil/sbutil.h | 8 ++++---- localdecls.h | 2 ++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libsandbox/libsandbox.h b/libsandbox/libsandbox.h index 0324b5b..3177253 100644 --- a/libsandbox/libsandbox.h +++ b/libsandbox/libsandbox.h @@ -63,9 +63,9 @@ extern void sb_unlock(void); void trace_main(const char *filename, char *const argv[]); -__attribute__((__format__(__printf__, 1, 2))) void sb_eqawarn(const char *format, ...); +__printf(1, 2) void sb_eqawarn(const char *format, ...); void sb_dump_backtrace(void); -__attribute__((noreturn)) void sb_abort(void); +__noreturn void sb_abort(void); /* glibc modified realpath() function */ char *erealpath(const char *, char *); diff --git a/libsbutil/sbutil.h b/libsbutil/sbutil.h index ad9ce25..f45402e 100644 --- a/libsbutil/sbutil.h +++ b/libsbutil/sbutil.h @@ -96,10 +96,10 @@ size_t sb_write(int fd, const void *buf, size_t count); int sb_close(int fd); /* Reliable output */ -__attribute__((__format__(__printf__, 1, 2))) void sb_printf(const char *format, ...); -__attribute__((__format__(__printf__, 2, 3))) void sb_fdprintf(int fd, const char *format, ...); -__attribute__((__format__(__printf__, 2, 0))) void sb_vfdprintf(int fd, const char *format, va_list args); -__attribute__((__format__(__printf__, 3, 4))) void sb_efunc(const char *color, const char *hilight, const char *format, ...); +__printf(1, 2) void sb_printf(const char *format, ...); +__printf(2, 3) void sb_fdprintf(int fd, const char *format, ...); +__printf(2, 0) void sb_vfdprintf(int fd, const char *format, va_list args); +__printf(3, 4) void sb_efunc(const char *color, const char *hilight, const char *format, ...); #define sb_fprintf(fp, ...) sb_fdprintf(fileno(fp), __VA_ARGS__) #define sb_vfprintf(fp, ...) sb_vfdprintf(fileno(fp), __VA_ARGS__) diff --git a/localdecls.h b/localdecls.h index 674e848..eef7295 100644 --- a/localdecls.h +++ b/localdecls.h @@ -119,5 +119,7 @@ typedef struct user_regs_struct trace_regs; #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) +#define __noreturn __attribute__((noreturn)) +#define __printf(x, y) __attribute__((__format__(__printf__, x, y))) #endif -- cgit v1.2.3-18-g5258