* [PATCH 0/1] git-compat-util.h: drop the PRIuMAX definition @ 2019-11-24 13:09 Hariom Verma via GitGitGadget 2019-11-24 13:09 ` [PATCH 1/1] git-compat-util.h: drop the `PRIuMAX` definition Hariom Verma via GitGitGadget 0 siblings, 1 reply; 8+ messages in thread From: Hariom Verma via GitGitGadget @ 2019-11-24 13:09 UTC (permalink / raw) To: git; +Cc: Hariom Verma, Junio C Hamano 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. This addresses https://github.com/gitgitgadget/git/issues/399 Hariom Verma (1): git-compat-util.h: drop the `PRIuMAX` definition git-compat-util.h | 4 ---- 1 file changed, 4 deletions(-) base-commit: d9f6f3b6195a0ca35642561e530798ad1469bd41 Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-473%2Fharry-hov%2Fpriumax-v1 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-473/harry-hov/priumax-v1 Pull-Request: https://github.com/gitgitgadget/git/pull/473 -- gitgitgadget ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/1] git-compat-util.h: drop the `PRIuMAX` definition 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 ` Hariom Verma via GitGitGadget 2019-11-24 17:06 ` Jeff King 0 siblings, 1 reply; 8+ messages in thread From: Hariom Verma via GitGitGadget @ 2019-11-24 13:09 UTC (permalink / raw) To: git; +Cc: Hariom Verma, Junio C Hamano, Hariom Verma From: Hariom Verma <hariom18599@gmail.com> 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`. This addresses https://github.com/gitgitgadget/git/issues/399 Signed-off-by: Hariom Verma <hariom18599@gmail.com> --- git-compat-util.h | 4 ---- 1 file changed, 4 deletions(-) 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 - #ifndef SCNuMAX #define SCNuMAX PRIuMAX #endif -- gitgitgadget ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] git-compat-util.h: drop the `PRIuMAX` definition 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-25 2:24 ` Junio C Hamano 0 siblings, 2 replies; 8+ messages in thread From: Jeff King @ 2019-11-24 17:06 UTC (permalink / raw) To: Hariom Verma via GitGitGadget; +Cc: git, Hariom Verma, Junio C Hamano On Sun, Nov 24, 2019 at 01:09:23PM +0000, Hariom Verma via GitGitGadget wrote: > From: Hariom Verma <hariom18599@gmail.com> > > 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] git-compat-util.h: drop the `PRIuMAX` definition 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 1 sibling, 1 reply; 8+ messages in thread From: Carlo Arenas @ 2019-11-24 17:40 UTC (permalink / raw) To: Jeff King Cc: Hariom Verma via GitGitGadget, git, Hariom Verma, Junio C Hamano On Sun, Nov 24, 2019 at 9:11 AM Jeff King <peff@peff.net> wrote: > > 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 think the problem might come from places where the default compiler is still not C99 by default (ex: old CentOS) and any other places using gcc < 5 which is less ancient Carlo ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] git-compat-util.h: drop the `PRIuMAX` definition 2019-11-24 17:40 ` Carlo Arenas @ 2019-11-24 20:15 ` Carlo Arenas 0 siblings, 0 replies; 8+ messages in thread From: Carlo Arenas @ 2019-11-24 20:15 UTC (permalink / raw) To: Jeff King Cc: Hariom Verma via GitGitGadget, git, Hariom Verma, Junio C Hamano On Sun, Nov 24, 2019 at 9:40 AM Carlo Arenas <carenas@gmail.com> wrote: > > I think the problem might come from places where the default compiler > is still not C99 by default (ex: old CentOS) CentOS 6.10 (using gcc 4.4.7) compiles this without problems by default so nothing to worry about, sorry for the red herring Carlo PS. non GNU89 (AKA ANSI) mode will obviously break but not ONLY because of this change ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] git-compat-util.h: drop the `PRIuMAX` definition 2019-11-24 17:06 ` Jeff King 2019-11-24 17:40 ` Carlo Arenas @ 2019-11-25 2:24 ` Junio C Hamano 2019-11-25 2:45 ` Junio C Hamano 1 sibling, 1 reply; 8+ messages in thread From: Junio C Hamano @ 2019-11-25 2:24 UTC (permalink / raw) To: Jeff King; +Cc: Hariom Verma via GitGitGadget, git, Hariom Verma Jeff King <peff@peff.net> writes: > On Sun, Nov 24, 2019 at 01:09:23PM +0000, Hariom Verma via GitGitGadget wrote: > >> From: Hariom Verma <hariom18599@gmail.com> >> >> 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. While I agree with the conclusion, I do not think I agree with the above "Therefore (implying that the lack of need for fallback PRIdMAX means the same for PRIuMAX) it should be safe" as a good justification. That reasoning assumes that the outside world is much saner than us. We thought PRIuMAX fallback necessary while a counterpart for PRIdMAX unneeded---the outside world could have made a similar mistake and in the opposite way (i.e. only defined PRIdMAX while leaving PRIuMAX undefined). But I do agree with the alternative justification in the following two paragraphs you have given, which are ... > 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. ... these. > 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. I guess that's also a C99-ism that we can use? Thanks, both. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] git-compat-util.h: drop the `PRIuMAX` definition 2019-11-25 2:24 ` Junio C Hamano @ 2019-11-25 2:45 ` Junio C Hamano 2019-11-25 9:34 ` Jeff King 0 siblings, 1 reply; 8+ messages in thread From: Junio C Hamano @ 2019-11-25 2:45 UTC (permalink / raw) To: Jeff King; +Cc: Hariom Verma via GitGitGadget, git, Hariom Verma 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] git-compat-util.h: drop the `PRIuMAX` definition 2019-11-25 2:45 ` Junio C Hamano @ 2019-11-25 9:34 ` Jeff King 0 siblings, 0 replies; 8+ messages in thread From: Jeff King @ 2019-11-25 9:34 UTC (permalink / raw) To: Junio C Hamano; +Cc: Hariom Verma via GitGitGadget, git, Hariom Verma On Mon, Nov 25, 2019 at 11:45:29AM +0900, Junio C Hamano wrote: > 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. Yes, that looks good to me (and yes, those other format macros are in C99, too). -Peff ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-11-25 9:34 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 2019-11-25 9:34 ` Jeff King
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.