Re: [PATCH 1/1] git-compat-util.h: drop the `PRIuMAX` definition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Nov 24, 2019 at 01:09:23PM +0000, Hariom Verma via GitGitGadget wrote:

> From: Hariom Verma <hariom18599@xxxxxxxxx>
> 
> 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).
> 
> Therefore it should be safe to drop the fallback definition for
> `PRIuMAX` in `git-compat-util.h`.

I noticed this recently, too, and wondered if it was time for a cleanup.

We do sometimes get portability reports more than a year after the
problem was introduced. But I think this one is pretty safe. PRIuMAX is
in C99, and we've been picking up other C99-isms without complaint.

I was curious what system originally spurred this. The PRIuMAX
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 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.

> diff --git a/git-compat-util.h b/git-compat-util.h
> index 607dca7534..ba710cfa6c 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -320,10 +320,6 @@ char *gitdirname(char *);
>  #define PATH_MAX 4096
>  #endif
>  
> -#ifndef PRIuMAX
> -#define PRIuMAX "llu"
> -#endif
> -

This part of the patch looks obviously correct. :) But...

>  #ifndef SCNuMAX
>  #define SCNuMAX PRIuMAX
>  #endif

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.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux