git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] ewah: fix building with gcc < 3.4.0

From
Tom G. Christensen <tgc@statsbiblioteket.dk>
Date
Feb 4, 2015, 08:23 UTC
Message-ID
<1423038196-804-1-git-send-email-tgc@statsbiblioteket.dk>
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
Previous: Junio C Hamano
Message 4 of 4 in “ewah: fix building with gcc < 3.4.0”
  1. ewah: fix building with gcc < 3.4.0Tom G. Christensen, Feb 3, 2015
  2. Jeff KingFeb 3, 2015
  3. Junio C HamanoFeb 3, 2015
  4. ewah: fix building with gcc < 3.4.0Tom G. Christensen, Feb 4, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.