From: Patrick Steinhardt <ps@pks•im>
To: Dominik Loidolt <dominik.loidolt@univie•ac.at>
Cc: gitster@pobox•com, git@vger•kernel.org, asedeno@mit•edu,
asedeno@google•com, avarab@gmail•com
Subject: Re: [PATCH v2] compat/posix.h: enable UNUSED warning messages for Clang
Date: Fri, 5 Jun 2026 15:22:49 +0200 [thread overview]
Message-ID: <aiLNqQgiQPlviB5X@pks.im> (raw)
In-Reply-To: <aiK4BR86cuq5bmCe@four.local>
On Fri, Jun 05, 2026 at 01:50:29PM +0200, Dominik Loidolt wrote:
> 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
next prev parent reply other threads:[~2026-06-05 13:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-03 15:12 [PATCH] compat/posix.h: enable UNUSED warning messages for Clang Dominik Loidolt
2026-05-04 1:10 ` Junio C Hamano
2026-05-04 1:41 ` Junio C Hamano
2026-06-05 8:44 ` Dominik Loidolt
2026-06-05 9:46 ` [PATCH v2] " Dominik Loidolt
2026-06-05 10:40 ` Patrick Steinhardt
2026-06-05 11:50 ` Dominik Loidolt
2026-06-05 13:22 ` Patrick Steinhardt [this message]
2026-06-05 15:53 ` Dominik Loidolt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aiLNqQgiQPlviB5X@pks.im \
--to=ps@pks$(echo .)im \
--cc=asedeno@google$(echo .)com \
--cc=asedeno@mit$(echo .)edu \
--cc=avarab@gmail$(echo .)com \
--cc=dominik.loidolt@univie$(echo .)ac.at \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox