Browse Source

silence a bunch of format-zero-length warnings

This can be observed in many versions of gcc and still exists with 4.9.0:

  wt-status.c: In function ‘wt_status_print_unmerged_header’:
  wt-status.c:191:2: warning: zero-length gnu_printf format string [-Wformat-zero-length]
    status_printf_ln(s, c, "");
    ^

The user have long been told to pass -Wno-format-zero-length, but a
patch that avoids warning altogether is not too noisy, so let's do
so.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Felipe Contreras 11 years ago committed by Junio C Hamano
parent
commit
7d7d680221
  1. 2
      builtin/commit.c
  2. 22
      wt-status.c

2
builtin/commit.c

@ -805,7 +805,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
committer_ident.buf); committer_ident.buf);


if (ident_shown) if (ident_shown)
status_printf_ln(s, GIT_COLOR_NORMAL, ""); status_printf_ln(s, GIT_COLOR_NORMAL, "%s", "");


saved_color_setting = s->use_color; saved_color_setting = s->use_color;
s->use_color = 0; s->use_color = 0;

22
wt-status.c

@ -187,7 +187,7 @@ static void wt_status_print_unmerged_header(struct wt_status *s)
} else { } else {
status_printf_ln(s, c, _(" (use \"git add/rm <file>...\" as appropriate to mark resolution)")); status_printf_ln(s, c, _(" (use \"git add/rm <file>...\" as appropriate to mark resolution)"));
} }
status_printf_ln(s, c, ""); status_printf_ln(s, c, "%s", "");
} }


static void wt_status_print_cached_header(struct wt_status *s) static void wt_status_print_cached_header(struct wt_status *s)
@ -203,7 +203,7 @@ static void wt_status_print_cached_header(struct wt_status *s)
status_printf_ln(s, c, _(" (use \"git reset %s <file>...\" to unstage)"), s->reference); status_printf_ln(s, c, _(" (use \"git reset %s <file>...\" to unstage)"), s->reference);
else else
status_printf_ln(s, c, _(" (use \"git rm --cached <file>...\" to unstage)")); status_printf_ln(s, c, _(" (use \"git rm --cached <file>...\" to unstage)"));
status_printf_ln(s, c, ""); status_printf_ln(s, c, "%s", "");
} }


static void wt_status_print_dirty_header(struct wt_status *s, static void wt_status_print_dirty_header(struct wt_status *s,
@ -222,7 +222,7 @@ static void wt_status_print_dirty_header(struct wt_status *s,
status_printf_ln(s, c, _(" (use \"git checkout -- <file>...\" to discard changes in working directory)")); status_printf_ln(s, c, _(" (use \"git checkout -- <file>...\" to discard changes in working directory)"));
if (has_dirty_submodules) if (has_dirty_submodules)
status_printf_ln(s, c, _(" (commit or discard the untracked or modified content in submodules)")); status_printf_ln(s, c, _(" (commit or discard the untracked or modified content in submodules)"));
status_printf_ln(s, c, ""); status_printf_ln(s, c, "%s", "");
} }


static void wt_status_print_other_header(struct wt_status *s, static void wt_status_print_other_header(struct wt_status *s,
@ -234,12 +234,12 @@ static void wt_status_print_other_header(struct wt_status *s,
if (!s->hints) if (!s->hints)
return; return;
status_printf_ln(s, c, _(" (use \"git %s <file>...\" to include in what will be committed)"), how); status_printf_ln(s, c, _(" (use \"git %s <file>...\" to include in what will be committed)"), how);
status_printf_ln(s, c, ""); status_printf_ln(s, c, "%s", "");
} }


static void wt_status_print_trailer(struct wt_status *s) static void wt_status_print_trailer(struct wt_status *s)
{ {
status_printf_ln(s, color(WT_STATUS_HEADER, s), ""); status_printf_ln(s, color(WT_STATUS_HEADER, s), "%s", "");
} }


#define quote_path quote_path_relative #define quote_path quote_path_relative
@ -767,7 +767,7 @@ static void wt_status_print_other(struct wt_status *s,
string_list_clear(&output, 0); string_list_clear(&output, 0);
strbuf_release(&buf); strbuf_release(&buf);
conclude: conclude:
status_printf_ln(s, GIT_COLOR_NORMAL, ""); status_printf_ln(s, GIT_COLOR_NORMAL, "%s", "");
} }


void wt_status_truncate_message_at_cut_line(struct strbuf *buf) void wt_status_truncate_message_at_cut_line(struct strbuf *buf)
@ -849,7 +849,7 @@ static void wt_status_print_tracking(struct wt_status *s)
color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "%c", color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "%c",
comment_line_char); comment_line_char);
else else
fprintf_ln(s->fp, ""); fputs("", s->fp);
} }


static int has_unmerged(struct wt_status *s) static int has_unmerged(struct wt_status *s)
@ -1265,7 +1265,7 @@ void wt_status_print(struct wt_status *s)
on_what = _("Not currently on any branch."); on_what = _("Not currently on any branch.");
} }
} }
status_printf(s, color(WT_STATUS_HEADER, s), ""); status_printf(s, color(WT_STATUS_HEADER, s), "%s", "");
status_printf_more(s, branch_status_color, "%s", on_what); status_printf_more(s, branch_status_color, "%s", on_what);
status_printf_more(s, branch_color, "%s\n", branch_name); status_printf_more(s, branch_color, "%s\n", branch_name);
if (!s->is_initial) if (!s->is_initial)
@ -1278,9 +1278,9 @@ void wt_status_print(struct wt_status *s)
free(state.detached_from); free(state.detached_from);


if (s->is_initial) { if (s->is_initial) {
status_printf_ln(s, color(WT_STATUS_HEADER, s), ""); status_printf_ln(s, color(WT_STATUS_HEADER, s), "%s", "");
status_printf_ln(s, color(WT_STATUS_HEADER, s), _("Initial commit")); status_printf_ln(s, color(WT_STATUS_HEADER, s), _("Initial commit"));
status_printf_ln(s, color(WT_STATUS_HEADER, s), ""); status_printf_ln(s, color(WT_STATUS_HEADER, s), "%s", "");
} }


wt_status_print_updated(s); wt_status_print_updated(s);
@ -1297,7 +1297,7 @@ void wt_status_print(struct wt_status *s)
if (s->show_ignored_files) if (s->show_ignored_files)
wt_status_print_other(s, &s->ignored, _("Ignored files"), "add -f"); wt_status_print_other(s, &s->ignored, _("Ignored files"), "add -f");
if (advice_status_u_option && 2000 < s->untracked_in_ms) { if (advice_status_u_option && 2000 < s->untracked_in_ms) {
status_printf_ln(s, GIT_COLOR_NORMAL, ""); status_printf_ln(s, GIT_COLOR_NORMAL, "%s", "");
status_printf_ln(s, GIT_COLOR_NORMAL, status_printf_ln(s, GIT_COLOR_NORMAL,
_("It took %.2f seconds to enumerate untracked files. 'status -uno'\n" _("It took %.2f seconds to enumerate untracked files. 'status -uno'\n"
"may speed it up, but you have to be careful not to forget to add\n" "may speed it up, but you have to be careful not to forget to add\n"

Loading…
Cancel
Save