git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] rebase-interactive.c: silence format-zero-length warnings

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 3, 2020, 14:20 UTC
Message-ID
<xmqqh7z5a5an.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<87196142-8473-7d19-4edd-7452eaefda1c@gmail.com>
Alban Gruin <alban.gruin@gmail.com> writes:
Show 8 quoted lines
>> Fixes the following warnings:
>> 
>> rebase-interactive.c: In function ‘edit_todo_list’:
>> rebase-interactive.c:137:38: warning: zero-length gnu_printf format string [-Wformat-zero-length]
>>     write_file(rebase_path_dropped(), "");
>> rebase-interactive.c:144:37: warning: zero-length gnu_printf format string [-Wformat-zero-length]
> ...
> On a tangent: what's wrong with empty format strings?

Those functions that are truly printf-like, such a call would be no-op and an indication of possible typo ("did you forget a %s or something?"), I presume.

But many of our functions that take printf-like format strings will do useful things even when an empty string is given, so the warning is unwanted.

Previous: Alban Gruin
Message 6 of 6 in “rebase-interactive.c: silence format-zero-length warnings”
  1. rebase-interactive.c: silence format-zero-length warningsRalf Thielow via GitGitGadget, Feb 27, 2020
  2. config.mak.dev: re-enable -Wformat-zero-lengthJeff King, Feb 27, 2020
  3. Junio C HamanoFeb 28, 2020
  4. Jeff KingFeb 28, 2020
  5. Alban GruinMar 3, 2020
  6. Junio C HamanoMar 3, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.