diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-04-08 13:07:22 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-04-08 13:07:22 +0200 |
commit | ea39176baab52b646d1e2676e662def718ddd365 (patch) | |
tree | b7efd5049894e2dd699222f9614ffcf01e892480 /src/proto.h | |
parent | 4ac2e8d8e60dcc7dbff662e177b86ccfbda7cd9e (diff) | |
download | vim-git-ea39176baab52b646d1e2676e662def718ddd365.tar.gz |
patch 8.0.1677: no compiler warning for wrong format in vim_snprintf()v8.0.1677
Problem: No compiler warning for wrong format in vim_snprintf().
Solution: Add printf attribute for gcc. Fix reported problems.
Diffstat (limited to 'src/proto.h')
-rw-r--r-- | src/proto.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/proto.h b/src/proto.h index 5513746dd..231c53f3b 100644 --- a/src/proto.h +++ b/src/proto.h @@ -119,13 +119,21 @@ int # ifdef __BORLANDC__ _RTLENTRYF # endif -vim_snprintf_add(char *, size_t, char *, ...); +vim_snprintf_add(char *, size_t, char *, ...) +#ifdef __GNUC__ + __attribute__((format(printf, 3, 4))) +#endif + ; int # ifdef __BORLANDC__ _RTLENTRYF # endif -vim_snprintf(char *, size_t, char *, ...); +vim_snprintf(char *, size_t, char *, ...) +#ifdef __GNUC__ + __attribute__((format(printf, 3, 4))) +#endif + ; int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap); int vim_vsnprintf_typval(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs); @@ -212,6 +220,14 @@ void qsort(void *base, size_t elm_count, size_t elm_size, int (*cmp)(const void # endif # ifdef FEAT_JOB_CHANNEL # include "channel.pro" + +/* Not generated automatically, to add extra attribute. */ +void ch_log(channel_T *ch, const char *fmt, ...) +#ifdef __GNUC__ + __attribute__((format(printf, 2, 3))) +#endif + ; + # endif # if defined(FEAT_GUI) || defined(FEAT_JOB_CHANNEL) |