Mercurial > vim
diff src/proto.h @ 13610:e76499e85744 v8.0.1677
patch 8.0.1677: no compiler warning for wrong format in vim_snprintf()
commit https://github.com/vim/vim/commit/ea39176baab52b646d1e2676e662def718ddd365
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Apr 8 13:07:22 2018 +0200
patch 8.0.1677: no compiler warning for wrong format in vim_snprintf()
Problem: No compiler warning for wrong format in vim_snprintf().
Solution: Add printf attribute for gcc. Fix reported problems.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 08 Apr 2018 13:15:07 +0200 |
parents | 0ebade0c0ab2 |
children | ea4f2a8040b4 |
line wrap: on
line diff
--- 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, # 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)