Skip to content

Commit 7d7d680

Browse files
felipecgitster
authored andcommitted
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 <[email protected]> Acked-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7bbc4e8 commit 7d7d680

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

builtin/commit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
805805
committer_ident.buf);
806806

807807
if (ident_shown)
808-
status_printf_ln(s, GIT_COLOR_NORMAL, "");
808+
status_printf_ln(s, GIT_COLOR_NORMAL, "%s", "");
809809

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

wt-status.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static void wt_status_print_unmerged_header(struct wt_status *s)
187187
} else {
188188
status_printf_ln(s, c, _(" (use \"git add/rm <file>...\" as appropriate to mark resolution)"));
189189
}
190-
status_printf_ln(s, c, "");
190+
status_printf_ln(s, c, "%s", "");
191191
}
192192

193193
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)
203203
status_printf_ln(s, c, _(" (use \"git reset %s <file>...\" to unstage)"), s->reference);
204204
else
205205
status_printf_ln(s, c, _(" (use \"git rm --cached <file>...\" to unstage)"));
206-
status_printf_ln(s, c, "");
206+
status_printf_ln(s, c, "%s", "");
207207
}
208208

209209
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,
222222
status_printf_ln(s, c, _(" (use \"git checkout -- <file>...\" to discard changes in working directory)"));
223223
if (has_dirty_submodules)
224224
status_printf_ln(s, c, _(" (commit or discard the untracked or modified content in submodules)"));
225-
status_printf_ln(s, c, "");
225+
status_printf_ln(s, c, "%s", "");
226226
}
227227

228228
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,
234234
if (!s->hints)
235235
return;
236236
status_printf_ln(s, c, _(" (use \"git %s <file>...\" to include in what will be committed)"), how);
237-
status_printf_ln(s, c, "");
237+
status_printf_ln(s, c, "%s", "");
238238
}
239239

240240
static void wt_status_print_trailer(struct wt_status *s)
241241
{
242-
status_printf_ln(s, color(WT_STATUS_HEADER, s), "");
242+
status_printf_ln(s, color(WT_STATUS_HEADER, s), "%s", "");
243243
}
244244

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

773773
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)
849849
color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "%c",
850850
comment_line_char);
851851
else
852-
fprintf_ln(s->fp, "");
852+
fputs("", s->fp);
853853
}
854854

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

12801280
if (s->is_initial) {
1281-
status_printf_ln(s, color(WT_STATUS_HEADER, s), "");
1281+
status_printf_ln(s, color(WT_STATUS_HEADER, s), "%s", "");
12821282
status_printf_ln(s, color(WT_STATUS_HEADER, s), _("Initial commit"));
1283-
status_printf_ln(s, color(WT_STATUS_HEADER, s), "");
1283+
status_printf_ln(s, color(WT_STATUS_HEADER, s), "%s", "");
12841284
}
12851285

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

0 commit comments

Comments
 (0)