All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org,
	"Carlo Marcelo Arenas Belón" <carenas@gmail.com>,
	"Jeff King" <peff@peff.net>,
	"Phillip Wood" <phillip.wood123@gmail.com>,
	"Eric Wong" <e@80x24.org>, "René Scharfe" <l.s.r@web.de>
Subject: cb/pedantic-build-for-developers, POSIX-but-not-C99 and -Wno-pedantic-ms-format
Date: Tue, 21 Sep 2021 10:44:02 +0200	[thread overview]
Message-ID: <87lf3q9u6b.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <xmqq1r5iaj9j.fsf@gitster.g>


On Mon, Sep 20 2021, Junio C Hamano wrote:

> * cb/pedantic-build-for-developers (2021-09-03) 3 commits
>   (merged to 'next' on 2021-09-10 at b8df102019)
>  + developer: enable pedantic by default
>  + win32: allow building with pedantic mode enabled
>  + gettext: remove optional non-standard parens in N_() definition
>
>  Update the build procedure to use the "-pedantic" build when
>  DEVELOPER makefile macro is in effect.

With -pedantic one of my WIP branches started erroring on:

    error: ISO C does not support %n$ operand number formats [-Werror=format=]

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):

    git grep '%\d+\$' -- po

  parent reply	other threads:[~2021-09-21  9:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-21  0:02 What's cooking in git.git (Sep 2021, #06; Mon, 20) Junio C Hamano
2021-09-21  1:16 ` Junio C Hamano
2021-09-21  3:22 ` Taylor Blau
2021-09-21  8:44 ` Ævar Arnfjörð Bjarmason [this message]
2021-09-21 10:10   ` cb/pedantic-build-for-developers, POSIX-but-not-C99 and -Wno-pedantic-ms-format Carlo Arenas
2021-09-21 10:30     ` René Scharfe
2021-09-21 10:48       ` Carlo Arenas
2021-09-22 16:15       ` Junio C Hamano
2021-09-22 16:58         ` René Scharfe
2021-09-22 16:13   ` Junio C Hamano
2021-09-22 16:25     ` Randall S. Becker
2021-09-22 17:22     ` Randall S. Becker
2021-09-22 17:38     ` Randall S. Becker
2021-09-21 23:07 ` What's cooking in git.git (Sep 2021, #06; Mon, 20) Ævar Arnfjörð Bjarmason
2021-09-23 16:36   ` Junio C Hamano
2021-09-23 16:51     ` Ævar Arnfjörð Bjarmason
2021-09-23 17:41       ` Jeff King
2021-09-22  0:22 ` ns/batched-fsync (was Re: What's cooking in git.git (Sep 2021, #06; Mon, 20)) Ævar Arnfjörð Bjarmason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lf3q9u6b.fsf@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=carenas@gmail.com \
    --cc=e@80x24.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=l.s.r@web.de \
    --cc=peff@peff.net \
    --cc=phillip.wood123@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.