Patch 8.0.1676
Problem:    No compiler warning for wrong printf format.
Solution:   Add a printf attribute for gcc. Fix reported problems. (Dominique
            Pelle, closes #2789)
Files:      src/channel.c, src/vim.h, src/proto/channel.pro


*** ../vim-8.0.1675/src/channel.c       2018-04-07 13:22:15.562979925 +0200
--- src/channel.c       2018-04-08 12:36:10.707198806 +0200
***************
*** 158,163 ****
--- 158,164 ----
  
  static int did_log_msg = TRUE;
  
+ #ifndef PROTO  /* prototype is in vim.h */
      void
  ch_log(channel_T *ch, const char *fmt, ...)
  {
***************
*** 174,179 ****
--- 175,188 ----
        did_log_msg = TRUE;
      }
  }
+ #endif
+ 
+     static void
+ ch_error(channel_T *ch, const char *fmt, ...)
+ #ifdef __GNUC__
+ __attribute__((format(printf, 2, 3)))
+ #endif
+     ;
  
      static void
  ch_error(channel_T *ch, const char *fmt, ...)
***************
*** 1442,1449 ****
        ch_close_part(channel, PART_IN);
      }
      else
!       ch_log(channel, "Still %d more lines to write",
!                                         buf->b_ml.ml_line_count - lnum + 1);
  }
  
  /*
--- 1451,1458 ----
        ch_close_part(channel, PART_IN);
      }
      else
!       ch_log(channel, "Still %ld more lines to write",
!                                  (long)(buf->b_ml.ml_line_count - lnum + 1));
  }
  
  /*
***************
*** 1536,1543 ****
            else if (written > 1)
                ch_log(channel, "written %d lines to channel", written);
            if (lnum < buf->b_ml.ml_line_count)
!               ch_log(channel, "Still %d more lines to write",
!                                             buf->b_ml.ml_line_count - lnum);
  
            in_part->ch_buf_bot = lnum;
        }
--- 1545,1552 ----
            else if (written > 1)
                ch_log(channel, "written %d lines to channel", written);
            if (lnum < buf->b_ml.ml_line_count)
!               ch_log(channel, "Still %ld more lines to write",
!                                      (long)(buf->b_ml.ml_line_count - lnum));
  
            in_part->ch_buf_bot = lnum;
        }
***************
*** 2081,2087 ****
        {
            *rettv = item->jq_value;
            if (tv->v_type == VAR_NUMBER)
!               ch_log(channel, "Getting JSON message %d", tv->vval.v_number);
            remove_json_node(head, item);
            return OK;
        }
--- 2090,2097 ----
        {
            *rettv = item->jq_value;
            if (tv->v_type == VAR_NUMBER)
!               ch_log(channel, "Getting JSON message %ld",
!                                                     (long)tv->vval.v_number);
            remove_json_node(head, item);
            return OK;
        }
*** ../vim-8.0.1675/src/vim.h   2018-03-29 15:55:30.874510195 +0200
--- src/vim.h   2018-04-08 12:32:53.164564819 +0200
***************
*** 2549,2552 ****
--- 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 */
*** ../vim-8.0.1675/src/proto/channel.pro       2018-03-16 20:46:52.674189967 
+0100
--- src/proto/channel.pro       2018-04-08 12:32:04.504902561 +0200
***************
*** 1,7 ****
  /* channel.c */
  void ch_logfile(char_u *fname, char_u *opt);
  int ch_log_active(void);
- void ch_log(channel_T *ch, const char *fmt, ...);
  channel_T *add_channel(void);
  int has_any_channel(void);
  int channel_unref(channel_T *channel);
--- 1,6 ----
*** ../vim-8.0.1675/src/version.c       2018-04-08 12:17:01.131208574 +0200
--- src/version.c       2018-04-08 12:36:45.454959230 +0200
***************
*** 764,765 ****
--- 764,767 ----
  {   /* Add new patch number below this line */
+ /**/
+     1676,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
131. You challenge authority and society by portnuking people

 /// 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