git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ewah: fix building with gcc < 3.4.0
@ 2015-02-03 10:27 Tom G. Christensen
  2015-02-03 16:35 ` Jeff King
  0 siblings, 1 reply; 4+ messages in thread
From: Tom G. Christensen @ 2015-02-03 10:27 UTC (permalink / raw)
  To: git

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.
---

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ewah: fix building with gcc < 3.4.0
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff King @ 2015-02-03 16:35 UTC (permalink / raw)
  To: Tom G. Christensen; +Cc: git

On Tue, Feb 03, 2015 at 11:27:07AM +0100, Tom G. Christensen wrote:

> 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.
> ---
> 
> 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.

Thanks. I built with some older gcc's at the time this was developed,
but I don't think I went past what was in Debian stable, which was
probably 4.something.

> -#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)

We could turn this into a HAS_CTZLL Makefile knob (and auto-set it as
above), but I don't think it is worth it. I don't expect anybody to need
to tweak it. I double-checked that clang sets the value of __GNUC__
appropriately.

-Peff

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ewah: fix building with gcc < 3.4.0
  2015-02-03 16:35 ` Jeff King
@ 2015-02-03 21:48   ` Junio C Hamano
  2015-02-04  8:23     ` [PATCH v2] " Tom G. Christensen
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2015-02-03 21:48 UTC (permalink / raw)
  To: Jeff King; +Cc: Tom G. Christensen, git

Jeff King <peff@peff.net> writes:

> On Tue, Feb 03, 2015 at 11:27:07AM +0100, Tom G. Christensen wrote:
>
>> 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.
>> ---
>> 
>> 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.
>
> Thanks. I built with some older gcc's at the time this was developed,
> but I don't think I went past what was in Debian stable, which was
> probably 4.something.
>
>> -#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)
>
> We could turn this into a HAS_CTZLL Makefile knob (and auto-set it as
> above), but I don't think it is worth it. I don't expect anybody to need
> to tweak it. I double-checked that clang sets the value of __GNUC__
> appropriately.

OK.  I would imagine that this would go on top of jk/pack-bitmap,
which we could be merged down to 2.0.x maintenance track if we
wanted to.

Tom, can you make it a habit to sign-off your patch?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] ewah: fix building with gcc < 3.4.0
  2015-02-03 21:48   ` Junio C Hamano
@ 2015-02-04  8:23     ` Tom G. Christensen
  0 siblings, 0 replies; 4+ messages in thread
From: Tom G. Christensen @ 2015-02-04  8:23 UTC (permalink / raw)
  To: git

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-04  8:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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     ` [PATCH v2] " Tom G. Christensen

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).