diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/conts/conts.h | 10 | ||||
| -rw-r--r-- | include/conts/sp.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/include/conts/conts.h b/include/conts/conts.h index 7f30873..a49a00c 100644 --- a/include/conts/conts.h +++ b/include/conts/conts.h @@ -4,6 +4,16 @@ #define CONTS_JOIN2(a, b) a##_##b #define CONTS_JOIN(a, b) CONTS_JOIN2(a, b) +#if !defined(__has_attribute) +#define __has_attribute(x) 0 +#endif + +#if __has_attribute(format) +#define CONTS_FMT(func, x, y) __attribute__ ((format(func, x, y))) +#else +#define CONTS_FMT(func, x, y) +#endif + #define CONTAINER_OF(ptr, type, member) \ (type *)((char *)(ptr) - offsetof(type, member)) diff --git a/include/conts/sp.h b/include/conts/sp.h index 73fcdda..2f88293 100644 --- a/include/conts/sp.h +++ b/include/conts/sp.h @@ -201,6 +201,7 @@ static inline int SP(append_vfmt)(struct SP_STRUCT *s, const char *fmt, va_list return 0; } +CONTS_FMT(__printf__, 2, 3) static inline int SP(append_fmt)(struct SP_STRUCT *s, const char *fmt, ...) { int r = 0; |
