From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEF54C433EF for ; Wed, 22 Sep 2021 17:22:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D3692610D1 for ; Wed, 22 Sep 2021 17:22:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236803AbhIVRYN convert rfc822-to-8bit (ORCPT ); Wed, 22 Sep 2021 13:24:13 -0400 Received: from elephants.elehost.com ([216.66.27.132]:26789 "EHLO elephants.elehost.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236701AbhIVRYM (ORCPT ); Wed, 22 Sep 2021 13:24:12 -0400 X-Virus-Scanned: amavisd-new at elehost.com Received: from gnash (cpe00fc8d49d843-cm00fc8d49d840.cpe.net.cable.rogers.com [173.33.197.34]) (authenticated bits=0) by elephants.elehost.com (8.15.2/8.15.2) with ESMTPSA id 18MHMYDg011146 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 22 Sep 2021 13:22:35 -0400 (EDT) (envelope-from rsbecker@nexbridge.com) From: "Randall S. Becker" To: "'Junio C Hamano'" , "=?UTF-8?Q?'=C3=86var_Arnfj=C3=B6r=C3=B0_Bjarmason'?=" Cc: , "=?UTF-8?Q?'Carlo_Marcelo_Arenas_Bel=C3=B3n'?=" , "'Jeff King'" , "'Phillip Wood'" , "'Eric Wong'" , "=?UTF-8?Q?'Ren=C3=A9_Scharfe'?=" References: <87lf3q9u6b.fsf@evledraar.gmail.com> In-Reply-To: Subject: RE: cb/pedantic-build-for-developers, POSIX-but-not-C99 and -Wno-pedantic-ms-format Date: Wed, 22 Sep 2021 13:22:29 -0400 Message-ID: <02c701d7afd6$6f0a7f20$4d1f7d60$@nexbridge.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Mailer: Microsoft Outlook 16.0 Content-Language: en-ca Thread-Index: AQMuoglFrJd/6yJXr/PiLib+ITjx0wGcUCbiAmfySIyo4jZ40A== Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On September 22, 2021 12:13 PM, Junio C Hamano: >Ævar Arnfjörð Bjarmason 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. Sincerely, Randall