0
0
mirror of https://github.com/vim/vim.git synced 2025-10-06 05:44:14 -04:00

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.
This commit is contained in:
Bram Moolenaar
2018-04-08 13:07:22 +02:00
parent 4ac2e8d8e6
commit ea39176baa
10 changed files with 51 additions and 31 deletions

View File

@@ -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)