Re: [PATCH v2] compat/posix.h: enable UNUSED warning messages for Clang
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jun 5, 2026, 13:22 UTC
- Message-ID
- <aiLNqQgiQPlviB5X@pks.im>
- In-Reply-To
- <aiK4BR86cuq5bmCe@four.local>
On Fri, Jun 05, 2026 at 01:50:29PM +0200, Dominik Loidolt wrote:
Show 23 quoted lines
> Thanks for the review! > > I noticed that the version-check style now differs between GCC and the newly > introduced Clang checks, would it make sense to make them consistent? Like: > > diff --git a/compat/posix.h b/compat/posix.h > index faaae1b655..e20f8ec61e 100644 > --- a/compat/posix.h > +++ b/compat/posix.h > @@ -17,7 +17,8 @@ > */ > #if defined(__GNUC__) && defined(__GNUC_MINOR__) > # define GIT_GNUC_PREREQ(maj, min) \ > - ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) > + ((__GNUC__ > (maj)) || \ > + (__GNUC__ == (maj) && (__GNUC_MINOR__ >= (min)))) > #else > #define GIT_GNUC_PREREQ(maj, min) 0 > #endif > > I think the current GCC bit-shift check is harder to read. > If you agree, I could send a 2-patch v3 series, which would also clean up the > comment style nit.
I was wondering about that, too. The question that I have is whether there's any particular reason why the check was written that way. So in the best case we'd do some digging into the history to figure out why this looks the way it looks like.
Patrick