diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2026-08-26 21:08:14 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2026-08-26 21:08:14 +0300 |
| commit | a6bf8cea4bebab12ff3c279a798870775a7c7abf (patch) | |
| tree | bcba217e1e633ec61a7357029a19572aed6efce1 /include | |
| parent | 14a6924d2fe27083556e323ec7efdee7567d3a4f (diff) | |
| download | conts-a6bf8cea4bebab12ff3c279a798870775a7c7abf.tar.gz conts-a6bf8cea4bebab12ff3c279a798870775a7c7abf.zip | |
add printf attribute
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; |
