mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.0.1676: no compiler warning for wrong printf format
Problem: No compiler warning for wrong printf format. Solution: Add a printf attribute for gcc. Fix reported problems. (Dominique Pelle, closes #2789)
This commit is contained in:
@@ -158,6 +158,7 @@ ch_log_lead(const char *what, channel_T *ch)
|
|||||||
|
|
||||||
static int did_log_msg = TRUE;
|
static int did_log_msg = TRUE;
|
||||||
|
|
||||||
|
#ifndef PROTO /* prototype is in vim.h */
|
||||||
void
|
void
|
||||||
ch_log(channel_T *ch, const char *fmt, ...)
|
ch_log(channel_T *ch, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
@@ -174,6 +175,14 @@ ch_log(channel_T *ch, const char *fmt, ...)
|
|||||||
did_log_msg = TRUE;
|
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
|
static void
|
||||||
ch_error(channel_T *ch, const char *fmt, ...)
|
ch_error(channel_T *ch, const char *fmt, ...)
|
||||||
@@ -1442,8 +1451,8 @@ channel_write_in(channel_T *channel)
|
|||||||
ch_close_part(channel, PART_IN);
|
ch_close_part(channel, PART_IN);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ch_log(channel, "Still %d more lines to write",
|
ch_log(channel, "Still %ld more lines to write",
|
||||||
buf->b_ml.ml_line_count - lnum + 1);
|
(long)(buf->b_ml.ml_line_count - lnum + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1536,8 +1545,8 @@ channel_write_new_lines(buf_T *buf)
|
|||||||
else if (written > 1)
|
else if (written > 1)
|
||||||
ch_log(channel, "written %d lines to channel", written);
|
ch_log(channel, "written %d lines to channel", written);
|
||||||
if (lnum < buf->b_ml.ml_line_count)
|
if (lnum < buf->b_ml.ml_line_count)
|
||||||
ch_log(channel, "Still %d more lines to write",
|
ch_log(channel, "Still %ld more lines to write",
|
||||||
buf->b_ml.ml_line_count - lnum);
|
(long)(buf->b_ml.ml_line_count - lnum));
|
||||||
|
|
||||||
in_part->ch_buf_bot = lnum;
|
in_part->ch_buf_bot = lnum;
|
||||||
}
|
}
|
||||||
@@ -2081,7 +2090,8 @@ channel_get_json(
|
|||||||
{
|
{
|
||||||
*rettv = item->jq_value;
|
*rettv = item->jq_value;
|
||||||
if (tv->v_type == VAR_NUMBER)
|
if (tv->v_type == VAR_NUMBER)
|
||||||
ch_log(channel, "Getting JSON message %d", tv->vval.v_number);
|
ch_log(channel, "Getting JSON message %ld",
|
||||||
|
(long)tv->vval.v_number);
|
||||||
remove_json_node(head, item);
|
remove_json_node(head, item);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
/* channel.c */
|
/* channel.c */
|
||||||
void ch_logfile(char_u *fname, char_u *opt);
|
void ch_logfile(char_u *fname, char_u *opt);
|
||||||
int ch_log_active(void);
|
int ch_log_active(void);
|
||||||
void ch_log(channel_T *ch, const char *fmt, ...);
|
|
||||||
channel_T *add_channel(void);
|
channel_T *add_channel(void);
|
||||||
int has_any_channel(void);
|
int has_any_channel(void);
|
||||||
int channel_unref(channel_T *channel);
|
int channel_unref(channel_T *channel);
|
||||||
|
@@ -762,6 +762,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1676,
|
||||||
/**/
|
/**/
|
||||||
1675,
|
1675,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -2549,4 +2549,11 @@ typedef enum {
|
|||||||
#define TERM_START_FORCEIT 2
|
#define TERM_START_FORCEIT 2
|
||||||
#define TERM_START_SYSTEM 4
|
#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 */
|
#endif /* VIM__H */
|
||||||
|
Reference in New Issue
Block a user