Re: [PATCH 3/3] Silence a bunch of format-zero-length warnings
Jeff King p...@peff.net writes: On Sun, May 04, 2014 at 07:01:22PM +, brian m. carlson wrote: On Sun, May 04, 2014 at 01:12:55AM -0500, Felipe Contreras wrote: This is in gcc 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, ); ^ We could pass -Wno-format-zero-length, but it seems compiler-specific flags are frowned upon, so let's just avoid the warning altogether. I believe these warnings existed before GCC 4.9 as well, but I'm not opposed to the change. Yeah, this started last summer when we added __attribute__((format)) to the status_printf_ln calls, and I posted essentially the same patch. We kind of waffled between eh, just set -Wno-format-zero-length and doing something, and ended up at the former. I'd be fine with doing it this way; we're not likely to add a lot of new callsites that would make it a hassle to keep up with. OK, so I'll take it as your Ack ;-) -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Re: [PATCH 3/3] Silence a bunch of format-zero-length warnings
On Wed, May 07, 2014 at 11:19:09AM -0700, Junio C Hamano wrote: Jeff King p...@peff.net writes: On Sun, May 04, 2014 at 07:01:22PM +, brian m. carlson wrote: On Sun, May 04, 2014 at 01:12:55AM -0500, Felipe Contreras wrote: This is in gcc 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, ); ^ We could pass -Wno-format-zero-length, but it seems compiler-specific flags are frowned upon, so let's just avoid the warning altogether. I believe these warnings existed before GCC 4.9 as well, but I'm not opposed to the change. Yeah, this started last summer when we added __attribute__((format)) to the status_printf_ln calls, and I posted essentially the same patch. We kind of waffled between eh, just set -Wno-format-zero-length and doing something, and ended up at the former. I'd be fine with doing it this way; we're not likely to add a lot of new callsites that would make it a hassle to keep up with. OK, so I'll take it as your Ack ;-) What happened to this patch? These warnings are still annoying me on my Ubuntu 14.04. Cheers Heiko -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] Silence a bunch of format-zero-length warnings
Heiko Voigt hvo...@hvoigt.net writes: On Wed, May 07, 2014 at 11:19:09AM -0700, Junio C Hamano wrote: Jeff King p...@peff.net writes: ... Yeah, this started last summer when we added __attribute__((format)) to the status_printf_ln calls, and I posted essentially the same patch. We kind of waffled between eh, just set -Wno-format-zero-length and doing something, and ended up at the former. I'd be fine with doing it this way; we're not likely to add a lot of new callsites that would make it a hassle to keep up with. OK, so I'll take it as your Ack ;-) What happened to this patch? These warnings are still annoying me on my Ubuntu 14.04. As Peff summarized, an earlier patch was dropped with It is easy for builders with such compilers to squelch the warning. We are reversing the course, with an updated log message like this ;-) 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. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] Silence a bunch of format-zero-length warnings
This is in gcc 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, ); ^ We could pass -Wno-format-zero-length, but it seems compiler-specific flags are frowned upon, so let's just avoid the warning altogether. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- builtin/commit.c | 2 +- wt-status.c | 22 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/builtin/commit.c b/builtin/commit.c index 9cfef6c..13b84e4 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -812,7 +812,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix, committer_ident.buf); if (ident_shown) - status_printf_ln(s, GIT_COLOR_NORMAL, ); + status_printf_ln(s, GIT_COLOR_NORMAL, %s, ); saved_color_setting = s-use_color; s-use_color = 0; diff --git a/wt-status.c b/wt-status.c index ec7344e..b8841e1 100644 --- a/wt-status.c +++ b/wt-status.c @@ -188,7 +188,7 @@ static void wt_status_print_unmerged_header(struct wt_status *s) } else { 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) @@ -204,7 +204,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); else 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, @@ -223,7 +223,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))); if (has_dirty_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, @@ -235,12 +235,12 @@ static void wt_status_print_other_header(struct wt_status *s, if (!s-hints) return; 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) { - 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 @@ -826,7 +826,7 @@ static void wt_status_print_other(struct wt_status *s, string_list_clear(output, 0); strbuf_release(buf); 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) @@ -913,7 +913,7 @@ static void wt_status_print_tracking(struct wt_status *s) color_fprintf_ln(s-fp, color(WT_STATUS_HEADER, s), %c, comment_line_char); else - fprintf_ln(s-fp, ); + fputs(, s-fp); } static int has_unmerged(struct wt_status *s) @@ -1329,7 +1329,7 @@ void wt_status_print(struct wt_status *s) 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_color, %s\n, branch_name); if (!s-is_initial) @@ -1342,9 +1342,9 @@ void wt_status_print(struct wt_status *s) free(state.detached_from); 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), ); + status_printf_ln(s, color(WT_STATUS_HEADER, s), %s, ); } wt_status_print_updated(s); @@ -1361,7 +1361,7 @@ void wt_status_print(struct wt_status *s) if (s-show_ignored_files) wt_status_print_other(s, s-ignored, _(Ignored files), add -f); if (advice_status_u_option 2000 s-untracked_in_ms) { - status_printf_ln(s,
Re: [PATCH 3/3] Silence a bunch of format-zero-length warnings
On Sun, May 04, 2014 at 01:12:55AM -0500, Felipe Contreras wrote: This is in gcc 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, ); ^ We could pass -Wno-format-zero-length, but it seems compiler-specific flags are frowned upon, so let's just avoid the warning altogether. I believe these warnings existed before GCC 4.9 as well, but I'm not opposed to the change. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH 3/3] Silence a bunch of format-zero-length warnings
brian m. carlson wrote: On Sun, May 04, 2014 at 01:12:55AM -0500, Felipe Contreras wrote: This is in gcc 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, ); ^ We could pass -Wno-format-zero-length, but it seems compiler-specific flags are frowned upon, so let's just avoid the warning altogether. I believe these warnings existed before GCC 4.9 as well, but I'm not opposed to the change. Yes, I'm aware of that. I didn't say they started to happen in 4.9, I said they happen in 4.9. -- Felipe Contreras-- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] Silence a bunch of format-zero-length warnings
On Sun, May 04, 2014 at 07:01:22PM +, brian m. carlson wrote: On Sun, May 04, 2014 at 01:12:55AM -0500, Felipe Contreras wrote: This is in gcc 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, ); ^ We could pass -Wno-format-zero-length, but it seems compiler-specific flags are frowned upon, so let's just avoid the warning altogether. I believe these warnings existed before GCC 4.9 as well, but I'm not opposed to the change. Yeah, this started last summer when we added __attribute__((format)) to the status_printf_ln calls, and I posted essentially the same patch. We kind of waffled between eh, just set -Wno-format-zero-length and doing something, and ended up at the former. I'd be fine with doing it this way; we're not likely to add a lot of new callsites that would make it a hassle to keep up with. -Peff -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html