Mercurial > vim
comparison src/libvterm/t/harness.c @ 19979:a80007999d01 v8.2.0545
patch 8.2.0545: unused arguments ignored in non-standard way
Commit: https://github.com/vim/vim/commit/d19a8f97ad58055a5e99cca8498d01e450ae37b2
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 11 21:42:48 2020 +0200
patch 8.2.0545: unused arguments ignored in non-standard way
Problem: Unused arguments ignored in non-standard way.
Solution: Add UNUSED instead of (void).
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 11 Apr 2020 21:45:04 +0200 |
parents | a042d2a3b13d |
children | deadaa5c2c49 |
comparison
equal
deleted
inserted
replaced
19978:93bca14dc077 | 19979:a80007999d01 |
---|---|
63 static VTermState *state; | 63 static VTermState *state; |
64 static VTermScreen *screen; | 64 static VTermScreen *screen; |
65 | 65 |
66 static VTermEncodingInstance encoding; | 66 static VTermEncodingInstance encoding; |
67 | 67 |
68 static int parser_text(const char bytes[], size_t len, void *user) | 68 static int parser_text(const char bytes[], size_t len, void *user UNUSED) |
69 { | 69 { |
70 size_t i; | 70 size_t i; |
71 (void)user; | |
72 | 71 |
73 printf("text "); | 72 printf("text "); |
74 for(i = 0; i < len; i++) { | 73 for(i = 0; i < len; i++) { |
75 unsigned char b = bytes[i]; | 74 unsigned char b = bytes[i]; |
76 if(b < 0x20 || b == 0x7f || (b >= 0x80 && b < 0xa0)) | 75 if(b < 0x20 || b == 0x7f || (b >= 0x80 && b < 0xa0)) |
80 printf("\n"); | 79 printf("\n"); |
81 | 80 |
82 return i; | 81 return i; |
83 } | 82 } |
84 | 83 |
85 static int parser_control(unsigned char control, void *user) | 84 static int parser_control(unsigned char control, void *user UNUSED) |
86 { | 85 { |
87 (void)user; | |
88 printf("control %02x\n", control); | 86 printf("control %02x\n", control); |
89 | 87 |
90 return 1; | 88 return 1; |
91 } | 89 } |
92 | 90 |
93 static int parser_escape(const char bytes[], size_t len, void *user) | 91 static int parser_escape(const char bytes[], size_t len, void *user UNUSED) |
94 { | 92 { |
95 size_t i; | 93 size_t i; |
96 (void)user; | |
97 | 94 |
98 if(bytes[0] >= 0x20 && bytes[0] < 0x30) { | 95 if(bytes[0] >= 0x20 && bytes[0] < 0x30) { |
99 if(len < 2) | 96 if(len < 2) |
100 return -1; | 97 return -1; |
101 len = 2; | 98 len = 2; |
110 printf("\n"); | 107 printf("\n"); |
111 | 108 |
112 return len; | 109 return len; |
113 } | 110 } |
114 | 111 |
115 static int parser_csi(const char *leader, const long args[], int argcount, const char *intermed, char command, void *user) | 112 static int parser_csi(const char *leader, const long args[], int argcount, const char *intermed, char command, void *user UNUSED) |
116 { | 113 { |
117 int i; | 114 int i; |
118 (void)user; | |
119 printf("csi %02x", command); | 115 printf("csi %02x", command); |
120 | 116 |
121 if(leader && leader[0]) { | 117 if(leader && leader[0]) { |
122 printf(" L="); | 118 printf(" L="); |
123 for(i = 0; leader[i]; i++) | 119 for(i = 0; leader[i]; i++) |
142 printf("\n"); | 138 printf("\n"); |
143 | 139 |
144 return 1; | 140 return 1; |
145 } | 141 } |
146 | 142 |
147 static int parser_osc(const char *command, size_t cmdlen, void *user) | 143 static int parser_osc(const char *command, size_t cmdlen, void *user UNUSED) |
148 { | 144 { |
149 size_t i; | 145 size_t i; |
150 (void)user; | |
151 | 146 |
152 printf("osc "); | 147 printf("osc "); |
153 for(i = 0; i < cmdlen; i++) | 148 for(i = 0; i < cmdlen; i++) |
154 printf("%02x", command[i]); | 149 printf("%02x", command[i]); |
155 printf("\n"); | 150 printf("\n"); |
156 | 151 |
157 return 1; | 152 return 1; |
158 } | 153 } |
159 | 154 |
160 static int parser_dcs(const char *command, size_t cmdlen, void *user) | 155 static int parser_dcs(const char *command, size_t cmdlen, void *user UNUSED) |
161 { | 156 { |
162 size_t i; | 157 size_t i; |
163 (void)user; | |
164 | 158 |
165 printf("dcs "); | 159 printf("dcs "); |
166 for(i = 0; i < cmdlen; i++) | 160 for(i = 0; i < cmdlen; i++) |
167 printf("%02x", command[i]); | 161 printf("%02x", command[i]); |
168 printf("\n"); | 162 printf("\n"); |
182 | 176 |
183 // These callbacks are shared by State and Screen | 177 // These callbacks are shared by State and Screen |
184 | 178 |
185 static int want_movecursor = 0; | 179 static int want_movecursor = 0; |
186 static VTermPos state_pos; | 180 static VTermPos state_pos; |
187 static int movecursor(VTermPos pos, VTermPos oldpos, int visible, void *user) | 181 static int movecursor(VTermPos pos, VTermPos oldpos UNUSED, int visible UNUSED, void *user UNUSED) |
188 { | 182 { |
189 (void)oldpos, (void)visible, (void)user; | |
190 state_pos = pos; | 183 state_pos = pos; |
191 | 184 |
192 if(want_movecursor) | 185 if(want_movecursor) |
193 printf("movecursor %d,%d\n", pos.row, pos.col); | 186 printf("movecursor %d,%d\n", pos.row, pos.col); |
194 | 187 |
195 return 1; | 188 return 1; |
196 } | 189 } |
197 | 190 |
198 static int want_scrollrect = 0; | 191 static int want_scrollrect = 0; |
199 static int scrollrect(VTermRect rect, int downward, int rightward, void *user) | 192 static int scrollrect(VTermRect rect, int downward, int rightward, void *user UNUSED) |
200 { | 193 { |
201 (void)user; | |
202 if(!want_scrollrect) | 194 if(!want_scrollrect) |
203 return 0; | 195 return 0; |
204 | 196 |
205 printf("scrollrect %d..%d,%d..%d => %+d,%+d\n", | 197 printf("scrollrect %d..%d,%d..%d => %+d,%+d\n", |
206 rect.start_row, rect.end_row, rect.start_col, rect.end_col, | 198 rect.start_row, rect.end_row, rect.start_col, rect.end_col, |
208 | 200 |
209 return 1; | 201 return 1; |
210 } | 202 } |
211 | 203 |
212 static int want_moverect = 0; | 204 static int want_moverect = 0; |
213 static int moverect(VTermRect dest, VTermRect src, void *user) | 205 static int moverect(VTermRect dest, VTermRect src, void *user UNUSED) |
214 { | 206 { |
215 (void)user; | |
216 if(!want_moverect) | 207 if(!want_moverect) |
217 return 0; | 208 return 0; |
218 | 209 |
219 printf("moverect %d..%d,%d..%d -> %d..%d,%d..%d\n", | 210 printf("moverect %d..%d,%d..%d -> %d..%d,%d..%d\n", |
220 src.start_row, src.end_row, src.start_col, src.end_col, | 211 src.start_row, src.end_row, src.start_col, src.end_col, |
222 | 213 |
223 return 1; | 214 return 1; |
224 } | 215 } |
225 | 216 |
226 static int want_settermprop = 0; | 217 static int want_settermprop = 0; |
227 static int settermprop(VTermProp prop, VTermValue *val, void *user) | 218 static int settermprop(VTermProp prop, VTermValue *val, void *user UNUSED) |
228 { | 219 { |
229 (void)user; | |
230 VTermValueType type; | 220 VTermValueType type; |
231 if(!want_settermprop) | 221 if(!want_settermprop) |
232 return 1; | 222 return 1; |
233 | 223 |
234 type = vterm_get_prop_type(prop); | 224 type = vterm_get_prop_type(prop); |
254 } | 244 } |
255 | 245 |
256 // These callbacks are for State | 246 // These callbacks are for State |
257 | 247 |
258 static int want_state_putglyph = 0; | 248 static int want_state_putglyph = 0; |
259 static int state_putglyph(VTermGlyphInfo *info, VTermPos pos, void *user) | 249 static int state_putglyph(VTermGlyphInfo *info, VTermPos pos, void *user UNUSED) |
260 { | 250 { |
261 int i; | 251 int i; |
262 (void)user; | |
263 if(!want_state_putglyph) | 252 if(!want_state_putglyph) |
264 return 1; | 253 return 1; |
265 | 254 |
266 printf("putglyph "); | 255 printf("putglyph "); |
267 for(i = 0; info->chars[i]; i++) | 256 for(i = 0; info->chars[i]; i++) |
277 | 266 |
278 return 1; | 267 return 1; |
279 } | 268 } |
280 | 269 |
281 static int want_state_erase = 0; | 270 static int want_state_erase = 0; |
282 static int state_erase(VTermRect rect, int selective, void *user) | 271 static int state_erase(VTermRect rect, int selective, void *user UNUSED) |
283 { | 272 { |
284 (void)user; | |
285 if(!want_state_erase) | 273 if(!want_state_erase) |
286 return 1; | 274 return 1; |
287 | 275 |
288 printf("erase %d..%d,%d..%d%s\n", | 276 printf("erase %d..%d,%d..%d%s\n", |
289 rect.start_row, rect.end_row, rect.start_col, rect.end_col, | 277 rect.start_row, rect.end_row, rect.start_col, rect.end_col, |
301 int strike; | 289 int strike; |
302 int font; | 290 int font; |
303 VTermColor foreground; | 291 VTermColor foreground; |
304 VTermColor background; | 292 VTermColor background; |
305 } state_pen; | 293 } state_pen; |
306 static int state_setpenattr(VTermAttr attr, VTermValue *val, void *user) | 294 static int state_setpenattr(VTermAttr attr, VTermValue *val, void *user UNUSED) |
307 { | 295 { |
308 (void)user; | |
309 switch(attr) { | 296 switch(attr) { |
310 case VTERM_ATTR_BOLD: | 297 case VTERM_ATTR_BOLD: |
311 state_pen.bold = val->boolean; | 298 state_pen.bold = val->boolean; |
312 break; | 299 break; |
313 case VTERM_ATTR_UNDERLINE: | 300 case VTERM_ATTR_UNDERLINE: |
340 } | 327 } |
341 | 328 |
342 return 1; | 329 return 1; |
343 } | 330 } |
344 | 331 |
345 static int state_setlineinfo(int row, const VTermLineInfo *newinfo, const VTermLineInfo *oldinfo, void *user) | 332 static int state_setlineinfo(int row UNUSED, const VTermLineInfo *newinfo UNUSED, const VTermLineInfo *oldinfo UNUSED, void *user UNUSED) |
346 { | 333 { |
347 (void)row, (void)newinfo, (void)oldinfo, (void)user; | |
348 return 1; | 334 return 1; |
349 } | 335 } |
350 | 336 |
351 VTermStateCallbacks state_cbs = { | 337 VTermStateCallbacks state_cbs = { |
352 state_putglyph, // putglyph | 338 state_putglyph, // putglyph |
362 state_setlineinfo, // setlineinfo | 348 state_setlineinfo, // setlineinfo |
363 }; | 349 }; |
364 | 350 |
365 static int want_screen_damage = 0; | 351 static int want_screen_damage = 0; |
366 static int want_screen_damage_cells = 0; | 352 static int want_screen_damage_cells = 0; |
367 static int screen_damage(VTermRect rect, void *user) | 353 static int screen_damage(VTermRect rect, void *user UNUSED) |
368 { | 354 { |
369 (void)user; | |
370 if(!want_screen_damage) | 355 if(!want_screen_damage) |
371 return 1; | 356 return 1; |
372 | 357 |
373 printf("damage %d..%d,%d..%d", | 358 printf("damage %d..%d,%d..%d", |
374 rect.start_row, rect.end_row, rect.start_col, rect.end_col); | 359 rect.start_row, rect.end_row, rect.start_col, rect.end_col); |
415 | 400 |
416 return 1; | 401 return 1; |
417 } | 402 } |
418 | 403 |
419 static int want_screen_scrollback = 0; | 404 static int want_screen_scrollback = 0; |
420 static int screen_sb_pushline(int cols, const VTermScreenCell *cells, void *user) | 405 static int screen_sb_pushline(int cols, const VTermScreenCell *cells, void *user UNUSED) |
421 { | 406 { |
422 int eol; | 407 int eol; |
423 int c; | 408 int c; |
424 (void)user; | |
425 | 409 |
426 if(!want_screen_scrollback) | 410 if(!want_screen_scrollback) |
427 return 1; | 411 return 1; |
428 | 412 |
429 eol = cols; | 413 eol = cols; |
436 printf("\n"); | 420 printf("\n"); |
437 | 421 |
438 return 1; | 422 return 1; |
439 } | 423 } |
440 | 424 |
441 static int screen_sb_popline(int cols, VTermScreenCell *cells, void *user) | 425 static int screen_sb_popline(int cols, VTermScreenCell *cells, void *user UNUSED) |
442 { | 426 { |
443 int col; | 427 int col; |
444 (void)user; | |
445 | 428 |
446 if(!want_screen_scrollback) | 429 if(!want_screen_scrollback) |
447 return 0; | 430 return 0; |
448 | 431 |
449 // All lines of scrollback contain "ABCDE" | 432 // All lines of scrollback contain "ABCDE" |
469 NULL, // resize | 452 NULL, // resize |
470 screen_sb_pushline, // sb_pushline | 453 screen_sb_pushline, // sb_pushline |
471 screen_sb_popline // sb_popline | 454 screen_sb_popline // sb_popline |
472 }; | 455 }; |
473 | 456 |
474 int main(int argc, char **argv) | 457 int main(int argc UNUSED, char **argv UNUSED) |
475 { | 458 { |
476 char line[1024] = {0}; | 459 char line[1024] = {0}; |
477 int flag; | 460 int flag; |
478 (void)argc, (void)argv; | |
479 | 461 |
480 int err; | 462 int err; |
481 | 463 |
482 setvbuf(stdout, NULL, _IONBF, 0); | 464 setvbuf(stdout, NULL, _IONBF, 0); |
483 | 465 |