To: vim_dev@googlegroups.com Subject: Patch 8.2.0436 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0436 Problem: No warnings for incorrect printf arguments. Solution: Fix attribute in declaration. Fix uncovered mistakes. (Dominique Pelle, closes #5834) Files: src/proto.h, src/eval.c, src/ops.c, src/spellfile.c, src/vim9compile.c, src/vim9execute.c, src/viminfo.c, src/gui.c *** ../vim-8.2.0435/src/proto.h 2020-02-26 16:15:31.072386953 +0100 --- src/proto.h 2020-03-23 22:06:59.238519488 +0100 *************** *** 119,125 **** // These prototypes cannot be produced automatically. int smsg(const char *, ...) # ifdef USE_PRINTF_FORMAT_ATTRIBUTE ! __attribute__((format(printf, 1, 0))) # endif ; --- 119,125 ---- // These prototypes cannot be produced automatically. int smsg(const char *, ...) # ifdef USE_PRINTF_FORMAT_ATTRIBUTE ! __attribute__((format(printf, 1, 2))) # endif ; *************** *** 138,151 **** // These prototypes cannot be produced automatically. int semsg(const char *, ...) # ifdef USE_PRINTF_FORMAT_ATTRIBUTE ! __attribute__((format(printf, 1, 0))) # endif ; // These prototypes cannot be produced automatically. void siemsg(const char *, ...) # ifdef USE_PRINTF_FORMAT_ATTRIBUTE ! __attribute__((format(printf, 1, 0))) # endif ; --- 138,151 ---- // These prototypes cannot be produced automatically. int semsg(const char *, ...) # ifdef USE_PRINTF_FORMAT_ATTRIBUTE ! __attribute__((format(printf, 1, 2))) # endif ; // These prototypes cannot be produced automatically. void siemsg(const char *, ...) # ifdef USE_PRINTF_FORMAT_ATTRIBUTE ! __attribute__((format(printf, 1, 2))) # endif ; *** ../vim-8.2.0435/src/eval.c 2020-03-01 16:22:37.064963530 +0100 --- src/eval.c 2020-03-23 22:10:06.705555594 +0100 *************** *** 2848,2854 **** if (verbose) { if (*skipwhite(*arg) == '(') ! semsg(_(e_nowhitespace)); else semsg(_(e_missing_paren), "lambda"); } --- 2848,2854 ---- if (verbose) { if (*skipwhite(*arg) == '(') ! emsg(_(e_nowhitespace)); else semsg(_(e_missing_paren), "lambda"); } *************** *** 2910,2916 **** else if (VIM_ISWHITE((*arg)[-1])) { if (verbose) ! semsg(_(e_nowhitespace)); ret = FAIL; } else --- 2910,2916 ---- else if (VIM_ISWHITE((*arg)[-1])) { if (verbose) ! emsg(_(e_nowhitespace)); ret = FAIL; } else *** ../vim-8.2.0435/src/ops.c 2020-03-15 19:17:47.297331940 +0100 --- src/ops.c 2020-03-23 22:06:25.242709934 +0100 *************** *** 2999,3005 **** curbuf->b_op_start = startpos; if (change_cnt > p_report) ! smsg(NGETTEXT("%ld line changed", "%ld lines changed", change_cnt), change_cnt); } } --- 2999,3005 ---- curbuf->b_op_start = startpos; if (change_cnt > p_report) ! smsg(NGETTEXT("%d line changed", "%d lines changed", change_cnt), change_cnt); } } *** ../vim-8.2.0435/src/spellfile.c 2020-01-07 20:59:30.528926519 +0100 --- src/spellfile.c 2020-03-23 22:06:25.246709911 +0100 *************** *** 4115,4121 **** pc = string_convert(&spin->si_conv, rline, NULL); if (pc == NULL) { ! smsg(_("Conversion failure for word in %s line %d: %s"), fname, lnum, rline); continue; } --- 4115,4121 ---- pc = string_convert(&spin->si_conv, rline, NULL); if (pc == NULL) { ! smsg(_("Conversion failure for word in %s line %ld: %s"), fname, lnum, rline); continue; } *************** *** 4133,4142 **** if (STRNCMP(line, "encoding=", 9) == 0) { if (spin->si_conv.vc_type != CONV_NONE) ! smsg(_("Duplicate /encoding= line ignored in %s line %d: %s"), fname, lnum, line - 1); else if (did_word) ! smsg(_("/encoding= line after word ignored in %s line %d: %s"), fname, lnum, line - 1); else { --- 4133,4142 ---- if (STRNCMP(line, "encoding=", 9) == 0) { if (spin->si_conv.vc_type != CONV_NONE) ! smsg(_("Duplicate /encoding= line ignored in %s line %ld: %s"), fname, lnum, line - 1); else if (did_word) ! smsg(_("/encoding= line after word ignored in %s line %ld: %s"), fname, lnum, line - 1); else { *************** *** 4159,4171 **** if (STRNCMP(line, "regions=", 8) == 0) { if (spin->si_region_count > 1) ! smsg(_("Duplicate /regions= line ignored in %s line %d: %s"), fname, lnum, line); else { line += 8; if (STRLEN(line) > MAXREGIONS * 2) ! smsg(_("Too many regions in %s line %d: %s"), fname, lnum, line); else { --- 4159,4171 ---- if (STRNCMP(line, "regions=", 8) == 0) { if (spin->si_region_count > 1) ! smsg(_("Duplicate /regions= line ignored in %s line %ld: %s"), fname, lnum, line); else { line += 8; if (STRLEN(line) > MAXREGIONS * 2) ! smsg(_("Too many regions in %s line %ld: %s"), fname, lnum, line); else { *************** *** 4179,4185 **** continue; } ! smsg(_("/ line ignored in %s line %d: %s"), fname, lnum, line - 1); continue; } --- 4179,4185 ---- continue; } ! smsg(_("/ line ignored in %s line %ld: %s"), fname, lnum, line - 1); continue; } *************** *** 4209,4215 **** l = *p - '0'; if (l == 0 || l > spin->si_region_count) { ! smsg(_("Invalid region nr in %s line %d: %s"), fname, lnum, p); break; } --- 4209,4215 ---- l = *p - '0'; if (l == 0 || l > spin->si_region_count) { ! smsg(_("Invalid region nr in %s line %ld: %s"), fname, lnum, p); break; } *************** *** 4217,4223 **** } else { ! smsg(_("Unrecognized flags in %s line %d: %s"), fname, lnum, p); break; } --- 4217,4223 ---- } else { ! smsg(_("Unrecognized flags in %s line %ld: %s"), fname, lnum, p); break; } *** ../vim-8.2.0435/src/vim9compile.c 2020-03-20 18:39:42.981273170 +0100 --- src/vim9compile.c 2020-03-23 22:11:02.669291513 +0100 *************** *** 1830,1836 **** } else { ! semsg("Namespace not supported yet: %s", **arg); goto theend; } } --- 1830,1836 ---- } else { ! semsg("Namespace not supported yet: %s", *arg); goto theend; } } *************** *** 2213,2219 **** if (**arg != '(') { if (*skipwhite(*arg) == '(') ! semsg(_(e_nowhitespace)); else semsg(_(e_missing_paren), "lambda"); clear_tv(&rettv); --- 2213,2219 ---- if (**arg != '(') { if (*skipwhite(*arg) == '(') ! emsg(_(e_nowhitespace)); else semsg(_(e_missing_paren), "lambda"); clear_tv(&rettv); *** ../vim-8.2.0435/src/vim9execute.c 2020-03-22 13:44:25.102475151 +0100 --- src/vim9execute.c 2020-03-23 22:06:25.246709911 +0100 *************** *** 1774,1787 **** } break; case ISN_EXECUTE: ! smsg("%4d EXECUTE %d", current, iptr->isn_arg.number); break; case ISN_LOAD: if (iptr->isn_arg.number < 0) smsg("%4d LOAD arg[%lld]", current, ! iptr->isn_arg.number + STACK_FRAME_SIZE); else ! smsg("%4d LOAD $%lld", current, iptr->isn_arg.number); break; case ISN_LOADV: smsg("%4d LOADV v:%s", current, --- 1774,1787 ---- } break; case ISN_EXECUTE: ! smsg("%4d EXECUTE %lld", current, (long long)(iptr->isn_arg.number)); break; case ISN_LOAD: if (iptr->isn_arg.number < 0) smsg("%4d LOAD arg[%lld]", current, ! (long long)(iptr->isn_arg.number + STACK_FRAME_SIZE)); else ! smsg("%4d LOAD $%lld", current, (long long)(iptr->isn_arg.number)); break; case ISN_LOADV: smsg("%4d LOADV v:%s", current, *************** *** 1817,1831 **** smsg("%4d LOADENV %s", current, iptr->isn_arg.string); break; case ISN_LOADREG: ! smsg("%4d LOADREG @%c", current, iptr->isn_arg.number); break; case ISN_STORE: if (iptr->isn_arg.number < 0) smsg("%4d STORE arg[%lld]", current, ! iptr->isn_arg.number + STACK_FRAME_SIZE); else ! smsg("%4d STORE $%lld", current, iptr->isn_arg.number); break; case ISN_STOREV: smsg("%4d STOREV v:%s", current, --- 1817,1831 ---- smsg("%4d LOADENV %s", current, iptr->isn_arg.string); break; case ISN_LOADREG: ! smsg("%4d LOADREG @%c", current, (char)(iptr->isn_arg.number)); break; case ISN_STORE: if (iptr->isn_arg.number < 0) smsg("%4d STORE arg[%lld]", current, ! (long long)(iptr->isn_arg.number + STACK_FRAME_SIZE)); else ! smsg("%4d STORE $%lld", current, (long long)(iptr->isn_arg.number)); break; case ISN_STOREV: smsg("%4d STOREV v:%s", current, *************** *** 1862,1868 **** smsg("%4d STOREENV $%s", current, iptr->isn_arg.string); break; case ISN_STOREREG: ! smsg("%4d STOREREG @%c", current, iptr->isn_arg.number); break; case ISN_STORENR: smsg("%4d STORE %lld in $%d", current, --- 1862,1868 ---- smsg("%4d STOREENV $%s", current, iptr->isn_arg.string); break; case ISN_STOREREG: ! smsg("%4d STOREREG @%c", current, (char)iptr->isn_arg.number); break; case ISN_STORENR: smsg("%4d STORE %lld in $%d", current, *************** *** 1872,1878 **** // constants case ISN_PUSHNR: ! smsg("%4d PUSHNR %lld", current, iptr->isn_arg.number); break; case ISN_PUSHBOOL: case ISN_PUSHSPEC: --- 1872,1878 ---- // constants case ISN_PUSHNR: ! smsg("%4d PUSHNR %lld", current, (long long)(iptr->isn_arg.number)); break; case ISN_PUSHBOOL: case ISN_PUSHSPEC: *************** *** 1941,1950 **** smsg("%4d PUSH v:exception", current); break; case ISN_NEWLIST: ! smsg("%4d NEWLIST size %lld", current, iptr->isn_arg.number); break; case ISN_NEWDICT: ! smsg("%4d NEWDICT size %lld", current, iptr->isn_arg.number); break; // function call --- 1941,1950 ---- smsg("%4d PUSH v:exception", current); break; case ISN_NEWLIST: ! smsg("%4d NEWLIST size %lld", current, (long long)(iptr->isn_arg.number)); break; case ISN_NEWDICT: ! smsg("%4d NEWDICT size %lld", current, (long long)(iptr->isn_arg.number)); break; // function call *************** *** 2153,2160 **** else smsg("%4d 2BOOL (!!val)", current); break; ! case ISN_2STRING: smsg("%4d 2STRING stack[%d]", current, ! iptr->isn_arg.number); break; case ISN_DROP: smsg("%4d DROP", current); break; --- 2153,2160 ---- else smsg("%4d 2BOOL (!!val)", current); break; ! case ISN_2STRING: smsg("%4d 2STRING stack[%lld]", current, ! (long long)(iptr->isn_arg.number)); break; case ISN_DROP: smsg("%4d DROP", current); break; *** ../vim-8.2.0435/src/viminfo.c 2020-02-10 22:44:29.088282843 +0100 --- src/viminfo.c 2020-03-23 22:06:25.246709911 +0100 *************** *** 2992,2998 **** if (p_verbose > 0) { verbose_enter(); ! smsg(_("Reading viminfo file \"%s\"%s%s%s"), fname, (flags & VIF_WANT_INFO) ? _(" info") : "", (flags & VIF_WANT_MARKS) ? _(" marks") : "", --- 2992,2998 ---- if (p_verbose > 0) { verbose_enter(); ! smsg(_("Reading viminfo file \"%s\"%s%s%s%s"), fname, (flags & VIF_WANT_INFO) ? _(" info") : "", (flags & VIF_WANT_MARKS) ? _(" marks") : "", *** ../vim-8.2.0435/src/gui.c 2020-02-26 16:15:31.068386966 +0100 --- src/gui.c 2020-03-23 22:07:57.714204082 +0100 *************** *** 542,548 **** if (STRCMP(use_gvimrc, "NONE") != 0 && STRCMP(use_gvimrc, "NORC") != 0 && do_source(use_gvimrc, FALSE, DOSO_NONE, NULL) != OK) ! semsg(_("E230: Cannot read from \"%s\""), use_gvimrc, NULL); } else { --- 542,548 ---- if (STRCMP(use_gvimrc, "NONE") != 0 && STRCMP(use_gvimrc, "NORC") != 0 && do_source(use_gvimrc, FALSE, DOSO_NONE, NULL) != OK) ! semsg(_("E230: Cannot read from \"%s\""), use_gvimrc); } else { *** ../vim-8.2.0435/src/version.c 2020-03-23 22:01:14.476768276 +0100 --- src/version.c 2020-03-23 22:04:39.223341975 +0100 *************** *** 740,741 **** --- 740,743 ---- { /* Add new patch number below this line */ + /**/ + 436, /**/ -- This is the polymorph virus! Follow these instructions carefully: 1. Send this message to everybody you know. 2. Format your harddisk. Thank you for your cooperation in spreading the most powerful virus ever! /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///