git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Tom G. Christensen" <tgc@statsbiblioteket.dk>
To: <git@vger.kernel.org>
Subject: [PATCH v2] ewah: fix building with gcc < 3.4.0
Date: Wed, 4 Feb 2015 09:23:16 +0100	[thread overview]
Message-ID: <1423038196-804-1-git-send-email-tgc@statsbiblioteket.dk> (raw)
In-Reply-To: <xmqqlhkepsyl.fsf@gitster.dls.corp.google.com>

The __builtin_ctzll function was added in gcc 3.4.0.
This extends the check for gcc so that use of __builtin_ctzll is only
enabled if gcc >= 3.4.0.

Signed-off-by: Tom G. Christensen <tgc@statsbiblioteket.dk>
---
v2:
Add S-o-b

v1:
I noticed this on RHEL3 during 2.0.0rc phase but I see that the same
issue was noticed on Debian Sarge:
http://article.gmane.org/gmane.comp.version-control.git/255190
RHEL3 ships with gcc 3.2.3.

With this patch git can build on RHEL3 provided cURL support is disabled.

 ewah/ewok.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ewah/ewok.h b/ewah/ewok.h
index f6ad190..13c6e20 100644
--- a/ewah/ewok.h
+++ b/ewah/ewok.h
@@ -47,7 +47,8 @@ static inline uint32_t ewah_bit_popcount64(uint64_t x)
 	return (x * 0x0101010101010101ULL) >> 56;
 }
 
-#ifdef __GNUC__
+/* __builtin_ctzll was not available until 3.4.0 */
+#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3  && __GNUC_MINOR > 3))
 #define ewah_bit_ctz64(x) __builtin_ctzll(x)
 #else
 static inline int ewah_bit_ctz64(uint64_t x)
-- 
2.2.2

      reply	other threads:[~2015-02-04  8:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-03 10:27 [PATCH] ewah: fix building with gcc < 3.4.0 Tom G. Christensen
2015-02-03 16:35 ` Jeff King
2015-02-03 21:48   ` Junio C Hamano
2015-02-04  8:23     ` Tom G. Christensen [this message]

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=1423038196-804-1-git-send-email-tgc@statsbiblioteket.dk \
    --to=tgc@statsbiblioteket.dk \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).