Re: [Change] Git build issue on NonStop
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Sep 18, 2025, 13:00 UTC
- Message-ID
- <aMwCcw-6l1x85Wz-@pks.im>
- In-Reply-To
- <20250918063152.GA1168297@coredump.intra.peff.net>
On Thu, Sep 18, 2025 at 02:31:52AM -0400, Jeff King wrote:
Show 34 quoted lines
> On Thu, Sep 18, 2025 at 07:37:34AM +0200, Patrick Steinhardt wrote:
>
> > > >diff --git a/t/unit-tests/clar/clar.c b/t/unit-tests/clar/clar.c index
> > > >80c5359425..f408af850f 100644
> > > >--- a/t/unit-tests/clar/clar.c
> > > >+++ b/t/unit-tests/clar/clar.c
> > > >@@ -875,8 +875,8 @@ void clar__assert_equal(
> > > > void *p1 = va_arg(args, void *), *p2 = va_arg(args, void *);
> > > > is_equal = (p1 == p2);
> > > > if (!is_equal)
> > > >- p_snprintf(buf, sizeof(buf), "0x%"PRIxPTR" !=
> > > >0x%"PRIxPTR,
> > > >- (uintptr_t)p1, (uintptr_t)p2);
> > > >+ p_snprintf(buf, sizeof(buf), "0x%"PRIuMAX" !=
> > > >0x%"PRIuMAX,
> > > >+ (uintmax_t)p1, (uintmax_t)p2);
> > > > }
> > > > else {
> > > > int i1 = va_arg(args, int), i2 = va_arg(args, int);
> > > >
> > > >would be sufficient.
> > >
> > > Yes, it would work. uintmax_t is part of the standard set while uintptr_t is
> > > considered an extension. Not my decision on this grouping. I'm setting
> > > the -D in CFLAGS to see if that works, I would be fine going that way,
> > > although better would be adding it into config.uname.mak in the NONSTOP
> > > section.
> >
> > That should work alright, yeah. Peff, do you want to create a PR in
> > https://github.com/clar-test/clar to fix this? Otherwise I can handle
> > this.
>
> I'd be happy if you take it from here. Note in what I posted above it
> should probably be PRIxMAX to show hex (not "u").One thing I missed: `uintmax_t` doesn't work on 32 bit systems:
::error file=clar.c,line=879::clar.c:879:8: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
879 | (uintmax_t)p1, (uintmax_t)p2);
| ^I'm inclined to just use "%p" instead and accept that this has platform-dependent behaviour. Means we'll have to drop the test for this, but that's the lesser evil from my point of view.
Patrick