All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Hariom Verma via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org, Hariom Verma <hariom18599@gmail.com>
Subject: Re: [PATCH 1/1] git-compat-util.h: drop the `PRIuMAX` definition
Date: Mon, 25 Nov 2019 11:45:29 +0900	[thread overview]
Message-ID: <xmqqv9r8y8qe.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <xmqq1rtwzoal.fsf@gitster-ct.c.googlers.com> (Junio C. Hamano's message of "Mon, 25 Nov 2019 11:24:02 +0900")

Junio C Hamano <gitster@pobox.com> writes:

>> Can we likewise ditch the fallback definition for SCNuMAX? And PRIu32,
>> etc? It seems likely any platform would either have all of them or none.
>
> I guess that's also a C99-ism that we can use?
>
> Thanks, both.

Here is what I have locally for now.

1:  98f866a929 ! 1:  ebc3278665 git-compat-util.h: drop the `PRIuMAX` definition
    @@ Metadata
     Author: Hariom Verma <hariom18599@gmail.com>
     
      ## Commit message ##
    -    git-compat-util.h: drop the `PRIuMAX` definition
    +    git-compat-util.h: drop the `PRIuMAX` and other fallback definitions
     
         Git's code base already seems to be using `PRIdMAX` without any such
         fallback definition for quite a while (75459410edd (json_writer: new
         routines to create JSON data, 2018-07-13), to be precise, and the
    -    first Git version to include that commit was v2.19.0).
    +    first Git version to include that commit was v2.19.0).  Having a
    +    fallback definition only for `PRIuMAX` is a bit inconsistent.
     
    -    Therefore it should be safe to drop the fallback definition for
    -    `PRIuMAX` in `git-compat-util.h`.
    +    We do sometimes get portability reports more than a year after the
    +    problem was introduced.  This one should be fairly safe.  PRIuMAX is
    +    in C99 (for that matter, SCNuMAX, PRIu32 and others also are), and
    +    we've been picking up other C99-isms without complaint.
     
    -    This addresses https://github.com/gitgitgadget/git/issues/399
    +    The PRIuMAX fallback definition was originally added in 3efb1f343a
    +    (Check for PRIuMAX rather than NO_C99_FORMAT in fast-import.c.,
    +    2007-02-20). But it was replacing a construct that was introduced in
    +    an even earlier commit, 579d1fbfaf (Add NO_C99_FORMAT to support
    +    older compilers., 2006-07-30), which talks about gcc 2.95.
    +
    +    That's pretty ancient at this point.
     
         Signed-off-by: Hariom Verma <hariom18599@gmail.com>
    +    Helped-by: Jeff King <peff@peff.net>
    +    [jc: tweaked both message and code, taking what peff wrote]
         Signed-off-by: Junio C Hamano <gitster@pobox.com>
     
      ## git-compat-util.h ##
    @@ git-compat-util.h: char *gitdirname(char *);
     -#define PRIuMAX "llu"
     -#endif
     -
    - #ifndef SCNuMAX
    - #define SCNuMAX PRIuMAX
    - #endif
    +-#ifndef SCNuMAX
    +-#define SCNuMAX PRIuMAX
    +-#endif
    +-
    +-#ifndef PRIu32
    +-#define PRIu32 "u"
    +-#endif
    +-
    +-#ifndef PRIx32
    +-#define PRIx32 "x"
    +-#endif
    +-
    +-#ifndef PRIo32
    +-#define PRIo32 "o"
    +-#endif
    +-
    + typedef uintmax_t timestamp_t;
    + #define PRItime PRIuMAX
    + #define parse_timestamp strtoumax

  reply	other threads:[~2019-11-25  2:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-24 13:09 [PATCH 0/1] git-compat-util.h: drop the PRIuMAX definition Hariom Verma via GitGitGadget
2019-11-24 13:09 ` [PATCH 1/1] git-compat-util.h: drop the `PRIuMAX` definition Hariom Verma via GitGitGadget
2019-11-24 17:06   ` Jeff King
2019-11-24 17:40     ` Carlo Arenas
2019-11-24 20:15       ` Carlo Arenas
2019-11-25  2:24     ` Junio C Hamano
2019-11-25  2:45       ` Junio C Hamano [this message]
2019-11-25  9:34         ` Jeff King

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=xmqqv9r8y8qe.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=hariom18599@gmail.com \
    --cc=peff@peff.net \
    /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.