# HG changeset patch # User Matti Hamalainen # Date 1578569801 -7200 # Node ID 262411458cdeace1564301f46c501b81efdfbe45 # Parent ccff3eb8dbb6602bbd2c65cdad0ec638bbd87c44 Add __attribute__(__format__ ..) specifiers for functions that use printf() style format specifiers. diff -r ccff3eb8dbb6 -r 262411458cde th_ioctx.h --- a/th_ioctx.h Wed Jan 08 02:36:42 2020 +0200 +++ b/th_ioctx.h Thu Jan 09 13:36:41 2020 +0200 @@ -89,8 +89,10 @@ int th_io_error_v(th_ioctx *ctx, const int err, const char *fmt, va_list ap); void th_io_msg_v(th_ioctx *ctx, const int level, const char *fmt, va_list ap); -int th_io_error(th_ioctx *ctx, const int err, const char *fmt, ...); -void th_io_msg(th_ioctx *ctx, const int level, const char *fmt, ...); +int th_io_error(th_ioctx *ctx, const int err, const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 3, 4))); +void th_io_msg(th_ioctx *ctx, const int level, const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 3, 4))); // @@ -109,7 +111,8 @@ char * thfgets(char *ptr, int size, th_ioctx *ctx); int thfputs(const char *ptr, th_ioctx *ctx); int thvfprintf(th_ioctx *ctx, const char *fmt, va_list ap); -int thfprintf(th_ioctx *ctx, const char *fmt, ...); +int thfprintf(th_ioctx *ctx, const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); int thfread_str(th_ioctx *ctx, void *ptr, const size_t len); BOOL thfread_u8(th_ioctx *ctx, uint8_t *); diff -r ccff3eb8dbb6 -r 262411458cde th_network.h --- a/th_network.h Wed Jan 08 02:36:42 2020 +0200 +++ b/th_network.h Thu Jan 09 13:36:41 2020 +0200 @@ -141,8 +141,10 @@ void (*msgfunc)(th_conn_t *conn, int loglevel, const char *msg), ssize_t bufsize); -void th_conn_err(th_conn_t *conn, int err, const char *fmt, ...); -void th_conn_msg(th_conn_t *conn, int loglevel, const char *fmt, ...); +void th_conn_err(th_conn_t *conn, int err, const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 3, 4))); +void th_conn_msg(th_conn_t *conn, int loglevel, const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 3, 4))); int th_conn_set_proxy(th_conn_t *conn, int type, int port, const char *host, int auth_type); int th_conn_set_proxy_mode(th_conn_t *conn, const int mode); diff -r ccff3eb8dbb6 -r 262411458cde th_string.h --- a/th_string.h Wed Jan 08 02:36:42 2020 +0200 +++ b/th_string.h Thu Jan 09 13:36:41 2020 +0200 @@ -104,16 +104,20 @@ void th_strip_ctrlchars(char *str); int th_vsnprintf(char *buf, size_t size, const char *fmt, va_list ap); -int th_snprintf(char *buf, size_t size, const char *fmt, ...); +int th_snprintf(char *buf, size_t size, const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 3, 4))); int th_vfprintf(FILE *fh, const char *fmt, va_list ap); -int th_fprintf(FILE *fh, const char *fmt, ...); +int th_fprintf(FILE *fh, const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); char *th_strdup_vprintf(const char *fmt, va_list ap); -char *th_strdup_printf(const char *fmt, ...); +char *th_strdup_printf(const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 1, 2))); void th_pstr_vprintf(char **buf, const char *fmt, va_list ap); -void th_pstr_printf(char **buf, const char *fmt, ...); +void th_pstr_printf(char **buf, const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); int th_pstr_cpy(char **pdst, const char *src); int th_pstr_cat(char **pdst, const char *src); diff -r ccff3eb8dbb6 -r 262411458cde th_util.h --- a/th_util.h Wed Jan 08 02:36:42 2020 +0200 +++ b/th_util.h Thu Jan 09 13:36:41 2020 +0200 @@ -133,9 +133,12 @@ int th_errno_to_error(int error); const char *th_error_str(int error); -void THERR(const char *fmt, ...); -void THMSG(int level, const char *fmt, ...); -void THPRINT(int level, const char *fmt, ...); +void THERR(const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 1, 2))); +void THMSG(int level, const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); +void THPRINT(int level, const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); void THERR_V(const char *fmt, va_list ap); void THMSG_V(int level, const char *fmt, va_list ap);