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

RE: cb/pedantic-build-for-developers, POSIX-but-not-C99 and -Wno-pedantic-ms-format

From
Randall S. Becker <rsbecker@nexbridge.com>
Date
Sep 22, 2021, 17:38 UTC
Message-ID
<02cd01d7afd8$bb060690$311213b0$@nexbridge.com>
In-Reply-To
<xmqqilys8u74.fsf@gitster.g>
On September 22, 2021 1:22 PM, I wrote:
Show 26 quoted lines
>On September 22, 2021 12:13 PM, Junio C Hamano:
>>Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>>
>>> I.e. complaining about "%m$" instead of "%" in printf formats, it's
>>> easy enough to fix in my case, it's just something I used to
>>> de-duplicate a rather complex format, this makes it C(89|99)-compliant:
>>>
>>>     -       strbuf_addf(&fmt, "%%s%%s%%s-%%0%1$lud.%%0%1$lud-%%s-%%s-%%s",
>>>     -                   (unsigned long)tmp.len);
>>>     +       strbuf_addf(&fmt, "%%s%%s%%s-%%0%lud.%%0%lud-%%s-%%s-%%s",
>>>     +                   (unsigned long)tmp.len, (unsigned long)tmp.len);
>>>
>>> But in general, do we view -pedantic as an implicit endorsement that
>>> we should be using less POSIX and more standard C than we otherwise would?
>>>
>>> I may be wrong, but I believe that construct is widely portable, we
>>> don't use it in the main source, but in the po/ files (so anything
>>> that uses git + gettext tests for this already):
>>
>>Reordering (_("%s %s"), a, b) to ("%2$s %1$s", a, b) is essential to make po/ work.
>>
>>While I do not think of a reason why it should not work, I am not sure duplicating (%1$s %1$s", a) falls into the same category.
>>
>>Any solution that makes the per-cent ridden format string is better
>
>Positional parameters do not work on all POSIX platforms. Please do not do this. NonStop will be locked out of future git releases.
I went back and checked the NonStop case history, which I should have done first. The issue was in wprintf and the fix was deployed, it just never made our development box.
Nevermind. I'm sorry.
-Randall
Previous: Randall S. BeckerNext: Ævar Arnfjörð Bjarmason
Message 13 of 18 in “What's cooking in git.git (Sep 2021, #06; Mon, 20)”
  1. Junio C HamanoSep 21, 2021
  2. Junio C HamanoSep 21, 2021
  3. Taylor BlauSep 21, 2021
  4. cb/pedantic-build-for-developers, POSIX-but-not-C99 and -Wno-pedantic-ms-formatÆvar Arnfjörð Bjarmason, Sep 21, 2021
  5. Carlo ArenasSep 21, 2021
  6. René ScharfeSep 21, 2021
  7. Carlo ArenasSep 21, 2021
  8. Junio C HamanoSep 22, 2021
  9. René ScharfeSep 22, 2021
  10. Junio C HamanoSep 22, 2021
  11. Randall S. BeckerSep 22, 2021
  12. Randall S. BeckerSep 22, 2021
  13. Randall S. BeckerSep 22, 2021
  14. Ævar Arnfjörð BjarmasonSep 21, 2021
  15. Junio C HamanoSep 23, 2021
  16. Ævar Arnfjörð BjarmasonSep 23, 2021
  17. Jeff KingSep 23, 2021
  18. ns/batched-fsync (was Re: What's cooking in git.git (Sep 2021, #06; Mon, 20))Ævar Arnfjörð Bjarmason, Sep 22, 2021

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.