From 47b02619339b7aa786e8deff98358bb7230c5867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Tue, 7 Apr 2020 21:46:49 +0200 Subject: [PATCH] Add format attribute to printf like functions --- deps/yopt.h | 4 +++- src/dir.h | 3 +++ src/util.h | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/deps/yopt.h b/deps/yopt.h index 98d969b..00877e1 100644 --- a/deps/yopt.h +++ b/deps/yopt.h @@ -113,7 +113,9 @@ static inline const yopt_opt_t *_yopt_find(const yopt_opt_t *o, const char *v) { return NULL; } - +#ifdef __GNUC__ +__attribute__((format(printf,3,4))) +#endif static inline int _yopt_err(yopt_t *o, char **val, const char *fmt, ...) { va_list va; va_start(va, fmt); diff --git a/src/dir.h b/src/dir.h index 8c145f1..9074057 100644 --- a/src/dir.h +++ b/src/dir.h @@ -128,6 +128,9 @@ void dir_setlasterr(const char *); /* Error message on fatal error, or NULL if there hasn't been a fatal error yet. */ extern char *dir_fatalerr; +#ifdef __GNUC__ +__attribute__((format(printf,1,2))) +#endif void dir_seterr(const char *, ...); extern int dir_ui; diff --git a/src/util.h b/src/util.h index 2c3e5ed..0d23e9c 100644 --- a/src/util.h +++ b/src/util.h @@ -106,6 +106,9 @@ int ncresize(int, int); void nccreate(int, int, const char *); /* printf something somewhere in the last created window */ +#ifdef __GNUC__ +__attribute__((format(printf,3,4))) +#endif void ncprint(int, int, const char *, ...); /* Add a "tab" to a window */