> Date: Wed, 21 Sep 2022 17:58:20 -0700 > Cc: bug-make@gnu.org > From: Paul Eggert <egg...@cs.ucla.edu> > > On 9/20/22 18:48, rsbec...@nexbridge.com wrote: > > I am sorry to say that the %j prefix is not safe or portable. There are > > major production platforms where this is not supported. I work on one of > > them. > > Which platform and version? I'd like to document this in Gnulib. Some > other GNU programs are using %j now so it might make sense for you to > file an enhancement request at some point, assuming %j is not supported > even in the latest version of the platform. > > Anyway, thanks, revised GNU Make patch attached; it does not assume %j.
The log message still says it does: > Don't assume that time_t fits in long, as some hosts (e.g., > glibc x86 -D_TIME_BITS=64) have 32-bit long and 64-bit time_t. > This fix uses C99 sprintf/scanf %jd and %ju, which is > safe to assume nowadays. > --- a/src/makeint.h > +++ b/src/makeint.h > @@ -294,6 +294,12 @@ char *strerror (int errnum); > #if HAVE_STDINT_H > # include <stdint.h> > #endif > +#ifndef PRIdMAX > +# define PRIdMAX "lld" > +#endif > +#ifndef PRIuMAX > +# define PRIuMAX "llu" > +#endif This will cause problems in the native MS-Windows builds, where printf in the system C runtime doesn't support %lld and %llu. (Unless I'm missing something: I didn't try to build Make with this patch. Apologies if this is taken care of somewhere and I didn't see it.) Thanks.