Patch 8.0.1677
Problem:    No compiler warning for wrong format in vim_snprintf().
Solution:   Add printf attribute for gcc.  Fix reported problems.
Files:      src/vim.h, src/proto.h, src/eval.c, src/fileio.c, src/mbyte.c,
            src/ops.c, src/spellfile.c, src/undo.c, src/json.c


*** ../vim-8.0.1676/src/vim.h   2018-04-08 12:38:22.194293134 +0200
--- src/vim.h   2018-04-08 12:39:53.393666225 +0200
***************
*** 2549,2559 ****
  #define TERM_START_FORCEIT    2
  #define TERM_START_SYSTEM     4
  
- /* 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 /* VIM__H */
--- 2549,2552 ----
*** ../vim-8.0.1676/src/proto.h 2017-11-19 20:34:54.882376757 +0100
--- src/proto.h 2018-04-08 12:42:12.376712429 +0200
***************
*** 119,131 ****
  #  ifdef __BORLANDC__
  _RTLENTRYF
  #  endif
! vim_snprintf_add(char *, size_t, char *, ...);
  
  int
  #  ifdef __BORLANDC__
  _RTLENTRYF
  #  endif
! vim_snprintf(char *, size_t, char *, ...);
  
  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);
--- 119,139 ----
  #  ifdef __BORLANDC__
  _RTLENTRYF
  #  endif
! 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 *, ...)
! #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,217 ****
--- 220,233 ----
  # 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)
*** ../vim-8.0.1676/src/eval.c  2018-04-04 22:57:24.109853647 +0200
--- src/eval.c  2018-04-08 12:44:43.407677639 +0200
***************
*** 7105,7111 ****
      {
        case VAR_NUMBER:
            vim_snprintf((char *)buf, NUMBUFLEN, "%lld",
!                                           (varnumber_T)varp->vval.v_number);
            return buf;
        case VAR_FUNC:
        case VAR_PARTIAL:
--- 7105,7111 ----
      {
        case VAR_NUMBER:
            vim_snprintf((char *)buf, NUMBUFLEN, "%lld",
!                                           (long long)varp->vval.v_number);
            return buf;
        case VAR_FUNC:
        case VAR_PARTIAL:
*** ../vim-8.0.1676/src/fileio.c        2018-04-04 22:57:24.113853625 +0200
--- src/fileio.c        2018-04-08 12:45:33.823332529 +0200
***************
*** 5315,5321 ****
        *p++ = ' ';
      if (shortmess(SHM_LINES))
        vim_snprintf((char *)p, IOSIZE - (p - IObuff),
!               "%ldL, %lldC", lnum, (varnumber_T)nchars);
      else
      {
        if (lnum == 1)
--- 5315,5321 ----
        *p++ = ' ';
      if (shortmess(SHM_LINES))
        vim_snprintf((char *)p, IOSIZE - (p - IObuff),
!               "%ldL, %lldC", lnum, (long long)nchars);
      else
      {
        if (lnum == 1)
***************
*** 5327,5333 ****
            STRCPY(p, _("1 character"));
        else
            vim_snprintf((char *)p, IOSIZE - (p - IObuff),
!                   _("%lld characters"), (varnumber_T)nchars);
      }
  }
  
--- 5327,5333 ----
            STRCPY(p, _("1 character"));
        else
            vim_snprintf((char *)p, IOSIZE - (p - IObuff),
!                   _("%lld characters"), (long long)nchars);
      }
  }
  
*** ../vim-8.0.1676/src/mbyte.c 2018-03-04 18:07:04.260592398 +0100
--- src/mbyte.c 2018-04-08 12:46:38.122892568 +0200
***************
*** 5040,5050 ****
  #else
      gtk_widget_modify_font(preedit_label, gui.norm_font);
  
!     vim_snprintf(buf, sizeof(buf), "#%06X", gui.norm_pixel);
      gdk_color_parse(buf, &color);
      gtk_widget_modify_fg(preedit_label, GTK_STATE_NORMAL, &color);
  
!     vim_snprintf(buf, sizeof(buf), "#%06X", gui.back_pixel);
      gdk_color_parse(buf, &color);
      gtk_widget_modify_bg(preedit_window, GTK_STATE_NORMAL, &color);
  #endif
--- 5040,5050 ----
  #else
      gtk_widget_modify_font(preedit_label, gui.norm_font);
  
!     vim_snprintf(buf, sizeof(buf), "#%06X", (unsigned)gui.norm_pixel);
      gdk_color_parse(buf, &color);
      gtk_widget_modify_fg(preedit_label, GTK_STATE_NORMAL, &color);
  
!     vim_snprintf(buf, sizeof(buf), "#%06X", (unsigned)gui.back_pixel);
      gdk_color_parse(buf, &color);
      gtk_widget_modify_bg(preedit_window, GTK_STATE_NORMAL, &color);
  #endif
*** ../vim-8.0.1676/src/ops.c   2018-03-06 19:51:09.138529945 +0100
--- src/ops.c   2018-04-08 12:51:00.793097036 +0200
***************
*** 5976,5988 ****
            buf2[i] = '\0';
        }
        else if (pre == 0)
!           vim_snprintf((char *)buf2, NUMBUFLEN, "%llu", n);
        else if (pre == '0')
!           vim_snprintf((char *)buf2, NUMBUFLEN, "%llo", n);
        else if (pre && hexupper)
!           vim_snprintf((char *)buf2, NUMBUFLEN, "%llX", n);
        else
!           vim_snprintf((char *)buf2, NUMBUFLEN, "%llx", n);
        length -= (int)STRLEN(buf2);
  
        /*
--- 5976,5992 ----
            buf2[i] = '\0';
        }
        else if (pre == 0)
!           vim_snprintf((char *)buf2, NUMBUFLEN, "%llu",
!                                                       (long long unsigned)n);
        else if (pre == '0')
!           vim_snprintf((char *)buf2, NUMBUFLEN, "%llo",
!                                                       (long long unsigned)n);
        else if (pre && hexupper)
!           vim_snprintf((char *)buf2, NUMBUFLEN, "%llX",
!                                                       (long long unsigned)n);
        else
!           vim_snprintf((char *)buf2, NUMBUFLEN, "%llx",
!                                                       (long long unsigned)n);
        length -= (int)STRLEN(buf2);
  
        /*
***************
*** 7501,7516 ****
                            _("Selected %s%ld of %ld Lines; %lld of %lld Words; 
%lld of %lld Bytes"),
                            buf1, line_count_selected,
                            (long)curbuf->b_ml.ml_line_count,
!                           word_count_cursor, word_count,
!                           byte_count_cursor, byte_count);
                else
                    vim_snprintf((char *)IObuff, IOSIZE,
                            _("Selected %s%ld of %ld Lines; %lld of %lld Words; 
%lld of %lld Chars; %lld of %lld Bytes"),
                            buf1, line_count_selected,
                            (long)curbuf->b_ml.ml_line_count,
!                           word_count_cursor, word_count,
!                           char_count_cursor, char_count,
!                           byte_count_cursor, byte_count);
            }
            else
            {
--- 7505,7525 ----
                            _("Selected %s%ld of %ld Lines; %lld of %lld Words; 
%lld of %lld Bytes"),
                            buf1, line_count_selected,
                            (long)curbuf->b_ml.ml_line_count,
!                           (long long)word_count_cursor,
!                           (long long)word_count,
!                           (long long)byte_count_cursor,
!                           (long long)byte_count);
                else
                    vim_snprintf((char *)IObuff, IOSIZE,
                            _("Selected %s%ld of %ld Lines; %lld of %lld Words; 
%lld of %lld Chars; %lld of %lld Bytes"),
                            buf1, line_count_selected,
                            (long)curbuf->b_ml.ml_line_count,
!                           (long long)word_count_cursor,
!                           (long long)word_count,
!                           (long long)char_count_cursor,
!                           (long long)char_count,
!                           (long long)byte_count_cursor,
!                           (long long)byte_count);
            }
            else
            {
***************
*** 7528,7544 ****
                        (char *)buf1, (char *)buf2,
                        (long)curwin->w_cursor.lnum,
                        (long)curbuf->b_ml.ml_line_count,
!                       word_count_cursor, word_count,
!                       byte_count_cursor, byte_count);
                else
                    vim_snprintf((char *)IObuff, IOSIZE,
                        _("Col %s of %s; Line %ld of %ld; Word %lld of %lld; 
Char %lld of %lld; Byte %lld of %lld"),
                        (char *)buf1, (char *)buf2,
                        (long)curwin->w_cursor.lnum,
                        (long)curbuf->b_ml.ml_line_count,
!                       word_count_cursor, word_count,
!                       char_count_cursor, char_count,
!                       byte_count_cursor, byte_count);
            }
        }
  
--- 7537,7553 ----
                        (char *)buf1, (char *)buf2,
                        (long)curwin->w_cursor.lnum,
                        (long)curbuf->b_ml.ml_line_count,
!                       (long long)word_count_cursor, (long long)word_count,
!                       (long long)byte_count_cursor, (long long)byte_count);
                else
                    vim_snprintf((char *)IObuff, IOSIZE,
                        _("Col %s of %s; Line %ld of %ld; Word %lld of %lld; 
Char %lld of %lld; Byte %lld of %lld"),
                        (char *)buf1, (char *)buf2,
                        (long)curwin->w_cursor.lnum,
                        (long)curbuf->b_ml.ml_line_count,
!                       (long long)word_count_cursor, (long long)word_count,
!                       (long long)char_count_cursor, (long long)char_count,
!                       (long long)byte_count_cursor, (long long)byte_count);
            }
        }
  
*** ../vim-8.0.1676/src/spellfile.c     2018-02-10 18:45:21.092821986 +0100
--- src/spellfile.c     2018-04-08 12:52:47.152370600 +0200
***************
*** 3649,3655 ****
        {
            spin->si_msg_count = 0;
            vim_snprintf((char *)message, sizeof(message),
!                   _("line %6d, word %6d - %s"),
                       lnum, spin->si_foldwcount + spin->si_keepwcount, w);
            msg_start();
            msg_puts_long_attr(message, 0);
--- 3649,3655 ----
        {
            spin->si_msg_count = 0;
            vim_snprintf((char *)message, sizeof(message),
!                   _("line %6d, word %6ld - %s"),
                       lnum, spin->si_foldwcount + spin->si_keepwcount, w);
            msg_start();
            msg_puts_long_attr(message, 0);
*** ../vim-8.0.1676/src/undo.c  2018-03-04 18:07:04.288592219 +0100
--- src/undo.c  2018-04-08 12:53:24.176117789 +0200
***************
*** 3029,3035 ****
        {
            if (ga_grow(&ga, 1) == FAIL)
                break;
!           vim_snprintf((char *)IObuff, IOSIZE, "%6ld %7ld  ",
                                                        uhp->uh_seq, changes);
            u_add_time(IObuff + STRLEN(IObuff), IOSIZE - STRLEN(IObuff),
                                                                uhp->uh_time);
--- 3029,3035 ----
        {
            if (ga_grow(&ga, 1) == FAIL)
                break;
!           vim_snprintf((char *)IObuff, IOSIZE, "%6ld %7d  ",
                                                        uhp->uh_seq, changes);
            u_add_time(IObuff + STRLEN(IObuff), IOSIZE - STRLEN(IObuff),
                                                                uhp->uh_time);
*** ../vim-8.0.1676/src/json.c  2018-03-13 13:10:37.140284761 +0100
--- src/json.c  2018-04-08 12:53:40.512006251 +0200
***************
*** 217,223 ****
  
        case VAR_NUMBER:
            vim_snprintf((char *)numbuf, NUMBUFLEN, "%lld",
!                                                   val->vval.v_number);
            ga_concat(gap, numbuf);
            break;
  
--- 217,223 ----
  
        case VAR_NUMBER:
            vim_snprintf((char *)numbuf, NUMBUFLEN, "%lld",
!                                               (long long)val->vval.v_number);
            ga_concat(gap, numbuf);
            break;
  
*** ../vim-8.0.1676/src/version.c       2018-04-08 12:38:22.194293134 +0200
--- src/version.c       2018-04-08 13:05:56.954619354 +0200
***************
*** 764,765 ****
--- 764,767 ----
  {   /* Add new patch number below this line */
+ /**/
+     1677,
  /**/

-- 
All true wisdom is found on T-shirts.

 /// Bram Moolenaar -- b...@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    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui