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>
Felipe Contreras committed
May 4, 2014 at 01:12 UTC
7d7d680221e6aac4210cf3c0be9ab237bc45b781
2 files changed
+12
-12
builtin/commit.c
+1
-1
@@ -805,7 +805,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
805
committer_ident.buf);
806
807
if (ident_shown)
808
- status_printf_ln(s, GIT_COLOR_NORMAL, "");
808
+ status_printf_ln(s, GIT_COLOR_NORMAL, "%s", "");
809
810
saved_color_setting = s->use_color;
811
s->use_color = 0;
wt-status.c
+11
-11
@@ -187,7 +187,7 @@ static void wt_status_print_unmerged_header(struct wt_status *s)
187
} else {
188
status_printf_ln(s, c, _(" (use \"git add/rm <file>...\" as appropriate to mark resolution)"));
189
}
190
- status_printf_ln(s, c, "");
190
+ status_printf_ln(s, c, "%s", "");
191
}
192
193
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)
203
status_printf_ln(s, c, _(" (use \"git reset %s <file>...\" to unstage)"), s->reference);
204
else
205
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", "");
207
}
208
209
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,
222
status_printf_ln(s, c, _(" (use \"git checkout -- <file>...\" to discard changes in working directory)"));
223
if (has_dirty_submodules)
224
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", "");
226
}
227
228
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,
234
if (!s->hints)
235
return;
236
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", "");
238
}
239
240
static void wt_status_print_trailer(struct wt_status *s)
241
{
242
- status_printf_ln(s, color(WT_STATUS_HEADER, s), "");
242
+ status_printf_ln(s, color(WT_STATUS_HEADER, s), "%s", "");
243
}
244
245
#define quote_path quote_path_relative
@@ -767,7 +767,7 @@ static void wt_status_print_other(struct wt_status *s,
767
string_list_clear(&output, 0);
768
strbuf_release(&buf);
769
conclude:
770
- status_printf_ln(s, GIT_COLOR_NORMAL, "");
770
+ status_printf_ln(s, GIT_COLOR_NORMAL, "%s", "");
771
}
772
773
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)
849
color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "%c",
850
comment_line_char);
851
else
852
- fprintf_ln(s->fp, "");
852
+ fputs("", s->fp);
853
}
854
855
static int has_unmerged(struct wt_status *s)
@@ -1265,7 +1265,7 @@ void wt_status_print(struct wt_status *s)
1265
on_what = _("Not currently on any branch.");
1266
}
1267
}
1268
- status_printf(s, color(WT_STATUS_HEADER, s), "");
1268
+ status_printf(s, color(WT_STATUS_HEADER, s), "%s", "");
1269
status_printf_more(s, branch_status_color, "%s", on_what);
1270
status_printf_more(s, branch_color, "%s\n", branch_name);
1271
if (!s->is_initial)
@@ -1278,9 +1278,9 @@ void wt_status_print(struct wt_status *s)
1278
free(state.detached_from);
1279
1280
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", "");
1282
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", "");
1284
}
1285
1286
wt_status_print_updated(s);
@@ -1297,7 +1297,7 @@ void wt_status_print(struct wt_status *s)
1297
if (s->show_ignored_files)
1298
wt_status_print_other(s, &s->ignored, _("Ignored files"), "add -f");
1299
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", "");
1301
status_printf_ln(s, GIT_COLOR_NORMAL,
1302
_("It took %.2f seconds to enumerate untracked files. 'status -uno'\n"
1303
"may speed it up, but you have to be careful not to forget to add\n"