Mercurial > vim
comparison src/proto.h @ 25475:038eb6d9003a v8.2.3274
patch 8.2.3274: macro for printf format check can be simplified
Commit: https://github.com/vim/vim/commit/952d9d827e5bfc66a6b1d39956e4e5596b09e2bd
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Aug 2 18:07:18 2021 +0200
patch 8.2.3274: macro for printf format check can be simplified
Problem: Macro for printf format check can be simplified.
Solution: Add ATTRIBUTE_FORMAT_PRINTF(). (Dominique Pell?, issue https://github.com/vim/vim/issues/8635)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 02 Aug 2021 18:15:06 +0200 |
parents | dc66d0284518 |
children | bb1097899693 |
comparison
equal
deleted
inserted
replaced
25474:c79b2530406a | 25475:038eb6d9003a |
---|---|
119 # ifdef FEAT_VIMINFO | 119 # ifdef FEAT_VIMINFO |
120 # include "viminfo.pro" | 120 # include "viminfo.pro" |
121 # endif | 121 # endif |
122 | 122 |
123 // These prototypes cannot be produced automatically. | 123 // These prototypes cannot be produced automatically. |
124 int smsg(const char *, ...) | 124 int smsg(const char *, ...) ATTRIBUTE_COLD ATTRIBUTE_FORMAT_PRINTF(1, 2); |
125 # ifdef USE_PRINTF_FORMAT_ATTRIBUTE | 125 |
126 __attribute__((format(printf, 1, 2))) | 126 int smsg_attr(int, const char *, ...) ATTRIBUTE_FORMAT_PRINTF(2, 3); |
127 # endif | 127 |
128 ; | 128 int smsg_attr_keep(int, const char *, ...) ATTRIBUTE_FORMAT_PRINTF(2, 3); |
129 | |
130 int smsg_attr(int, const char *, ...) | |
131 # ifdef USE_PRINTF_FORMAT_ATTRIBUTE | |
132 __attribute__((format(printf, 2, 3))) | |
133 # endif | |
134 ; | |
135 | |
136 int smsg_attr_keep(int, const char *, ...) | |
137 # ifdef USE_PRINTF_FORMAT_ATTRIBUTE | |
138 __attribute__((format(printf, 2, 3))) | |
139 # endif | |
140 ; | |
141 | 129 |
142 // These prototypes cannot be produced automatically. | 130 // These prototypes cannot be produced automatically. |
143 int semsg(const char *, ...) | 131 int semsg(const char *, ...) ATTRIBUTE_COLD ATTRIBUTE_FORMAT_PRINTF(1, 2); |
144 # ifdef USE_PRINTF_FORMAT_ATTRIBUTE | |
145 __attribute__((format(printf, 1, 2))) | |
146 # endif | |
147 ; | |
148 | 132 |
149 // These prototypes cannot be produced automatically. | 133 // These prototypes cannot be produced automatically. |
150 void siemsg(const char *, ...) | 134 void siemsg(const char *, ...) ATTRIBUTE_COLD ATTRIBUTE_FORMAT_PRINTF(1, 2); |
151 # ifdef USE_PRINTF_FORMAT_ATTRIBUTE | 135 |
152 __attribute__((format(printf, 1, 2))) | 136 int vim_snprintf_add(char *, size_t, const char *, ...) ATTRIBUTE_FORMAT_PRINTF(3, 4); |
153 # endif | 137 |
154 ; | 138 int vim_snprintf(char *, size_t, const char *, ...) ATTRIBUTE_FORMAT_PRINTF(3, 4); |
155 | 139 |
156 int vim_snprintf_add(char *, size_t, const char *, ...) | 140 int vim_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) |
157 # ifdef USE_PRINTF_FORMAT_ATTRIBUTE | 141 ATTRIBUTE_FORMAT_PRINTF(3, 0); |
158 __attribute__((format(printf, 3, 4))) | 142 int vim_vsnprintf_typval(char *str, size_t str_m, const char *fmt, va_list ap, typval_T *tvs) |
159 # endif | 143 ATTRIBUTE_FORMAT_PRINTF(3, 0); |
160 ; | |
161 | |
162 int vim_snprintf(char *, size_t, const char *, ...) | |
163 # ifdef USE_PRINTF_FORMAT_ATTRIBUTE | |
164 __attribute__((format(printf, 3, 4))) | |
165 # endif | |
166 ; | |
167 | |
168 int vim_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap); | |
169 int vim_vsnprintf_typval(char *str, size_t str_m, const char *fmt, va_list ap, typval_T *tvs); | |
170 | 144 |
171 # include "message.pro" | 145 # include "message.pro" |
172 # include "misc1.pro" | 146 # include "misc1.pro" |
173 # include "misc2.pro" | 147 # include "misc2.pro" |
174 # ifndef HAVE_STRPBRK // not generated automatically from misc2.c | 148 # ifndef HAVE_STRPBRK // not generated automatically from misc2.c |
282 # ifdef FEAT_JOB_CHANNEL | 256 # ifdef FEAT_JOB_CHANNEL |
283 # include "job.pro" | 257 # include "job.pro" |
284 # include "channel.pro" | 258 # include "channel.pro" |
285 | 259 |
286 // Not generated automatically, to add extra attribute. | 260 // Not generated automatically, to add extra attribute. |
287 void ch_log(channel_T *ch, const char *fmt, ...) | 261 void ch_log(channel_T *ch, const char *fmt, ...) ATTRIBUTE_FORMAT_PRINTF(2, 3); |
288 # ifdef USE_PRINTF_FORMAT_ATTRIBUTE | |
289 __attribute__((format(printf, 2, 3))) | |
290 # endif | |
291 ; | |
292 | 262 |
293 # endif | 263 # endif |
294 | 264 |
295 # if defined(FEAT_GUI) || defined(FEAT_JOB_CHANNEL) | 265 # if defined(FEAT_GUI) || defined(FEAT_JOB_CHANNEL) |
296 # if defined(UNIX) || defined(MACOS_X) || defined(VMS) | 266 # if defined(UNIX) || defined(MACOS_X) || defined(VMS) |