{"thread":{"id":"38492","subject":"[PATCH] ewah: fix building with gcc < 3.4.0","startedAt":"2015-02-03T10:27:07Z","lastAt":"2015-02-04T08:23:16Z","messageCount":4,"participants":["Tom G. Christensen","Jeff King","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"255571","messageId":"1422959227-3046-1-git-send-email-tgc@statsbiblioteket.dk","threadId":"38492","inReplyTo":null,"subject":"[PATCH] ewah: fix building with gcc < 3.4.0","fromName":"Tom G. Christensen","fromEmail":"tgc@statsbiblioteket.dk","sentAt":"2015-02-03T10:27:07Z","receivedAt":"2015-02-03T10:27:07Z","isPatch":true,"sender":{"key":"tgc@statsbiblioteket.dk","avatar":"https://avatars.githubusercontent.com/u/912180?v=4"},"body":"The __builtin_ctzll function was added in gcc 3.4.0.\nThis extends the check for gcc so that use of __builtin_ctzll is only\nenabled if gcc >= 3.4.0.\n---\n\nI noticed this on RHEL3 during 2.0.0rc phase but I see that the same\nissue was noticed on Debian Sarge:\nhttp://article.gmane.org/gmane.comp.version-control.git/255190\nRHEL3 ships with gcc 3.2.3.\n\nWith this patch git can build on RHEL3 provided cURL support is disabled.\n\n ewah/ewok.h | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/ewah/ewok.h b/ewah/ewok.h\nindex f6ad190..13c6e20 100644\n--- a/ewah/ewok.h\n+++ b/ewah/ewok.h\n@@ -47,7 +47,8 @@ static inline uint32_t ewah_bit_popcount64(uint64_t x)\n \treturn (x * 0x0101010101010101ULL) >> 56;\n }\n \n-#ifdef __GNUC__\n+/* __builtin_ctzll was not available until 3.4.0 */\n+#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3  && __GNUC_MINOR > 3))\n #define ewah_bit_ctz64(x) __builtin_ctzll(x)\n #else\n static inline int ewah_bit_ctz64(uint64_t x)\n-- \n2.2.2\n"},{"id":"255578","messageId":"20150203163545.GB9325@peff.net","threadId":"38492","inReplyTo":"1422959227-3046-1-git-send-email-tgc@statsbiblioteket.dk","subject":"Re: [PATCH] ewah: fix building with gcc < 3.4.0","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-02-03T16:35:45Z","receivedAt":"2015-02-03T16:35:45Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Feb 03, 2015 at 11:27:07AM +0100, Tom G. Christensen wrote:\n\n> The __builtin_ctzll function was added in gcc 3.4.0.\n> This extends the check for gcc so that use of __builtin_ctzll is only\n> enabled if gcc >= 3.4.0.\n> ---\n> \n> I noticed this on RHEL3 during 2.0.0rc phase but I see that the same\n> issue was noticed on Debian Sarge:\n> http://article.gmane.org/gmane.comp.version-control.git/255190\n> RHEL3 ships with gcc 3.2.3.\n> \n> With this patch git can build on RHEL3 provided cURL support is disabled.\n\nThanks. I built with some older gcc's at the time this was developed,\nbut I don't think I went past what was in Debian stable, which was\nprobably 4.something.\n\n> -#ifdef __GNUC__\n> +/* __builtin_ctzll was not available until 3.4.0 */\n> +#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3  && __GNUC_MINOR > 3))\n>  #define ewah_bit_ctz64(x) __builtin_ctzll(x)\n>  #else\n>  static inline int ewah_bit_ctz64(uint64_t x)\n\nWe could turn this into a HAS_CTZLL Makefile knob (and auto-set it as\nabove), but I don't think it is worth it. I don't expect anybody to need\nto tweak it. I double-checked that clang sets the value of __GNUC__\nappropriately.\n\n-Peff\n"},{"id":"255590","messageId":"xmqqlhkepsyl.fsf@gitster.dls.corp.google.com","threadId":"38492","inReplyTo":"20150203163545.GB9325@peff.net","subject":"Re: [PATCH] ewah: fix building with gcc < 3.4.0","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-02-03T21:48:18Z","receivedAt":"2015-02-03T21:48:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Tue, Feb 03, 2015 at 11:27:07AM +0100, Tom G. Christensen wrote:\n>\n>> The __builtin_ctzll function was added in gcc 3.4.0.\n>> This extends the check for gcc so that use of __builtin_ctzll is only\n>> enabled if gcc >= 3.4.0.\n>> ---\n>> \n>> I noticed this on RHEL3 during 2.0.0rc phase but I see that the same\n>> issue was noticed on Debian Sarge:\n>> http://article.gmane.org/gmane.comp.version-control.git/255190\n>> RHEL3 ships with gcc 3.2.3.\n>> \n>> With this patch git can build on RHEL3 provided cURL support is disabled.\n>\n> Thanks. I built with some older gcc's at the time this was developed,\n> but I don't think I went past what was in Debian stable, which was\n> probably 4.something.\n>\n>> -#ifdef __GNUC__\n>> +/* __builtin_ctzll was not available until 3.4.0 */\n>> +#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3  && __GNUC_MINOR > 3))\n>>  #define ewah_bit_ctz64(x) __builtin_ctzll(x)\n>>  #else\n>>  static inline int ewah_bit_ctz64(uint64_t x)\n>\n> We could turn this into a HAS_CTZLL Makefile knob (and auto-set it as\n> above), but I don't think it is worth it. I don't expect anybody to need\n> to tweak it. I double-checked that clang sets the value of __GNUC__\n> appropriately.\n\nOK.  I would imagine that this would go on top of jk/pack-bitmap,\nwhich we could be merged down to 2.0.x maintenance track if we\nwanted to.\n\nTom, can you make it a habit to sign-off your patch?\n"},{"id":"255601","messageId":"1423038196-804-1-git-send-email-tgc@statsbiblioteket.dk","threadId":"38492","inReplyTo":"xmqqlhkepsyl.fsf@gitster.dls.corp.google.com","subject":"[PATCH v2] ewah: fix building with gcc < 3.4.0","fromName":"Tom G. Christensen","fromEmail":"tgc@statsbiblioteket.dk","sentAt":"2015-02-04T08:23:16Z","receivedAt":"2015-02-04T08:23:16Z","isPatch":true,"sender":{"key":"tgc@statsbiblioteket.dk","avatar":"https://avatars.githubusercontent.com/u/912180?v=4"},"body":"The __builtin_ctzll function was added in gcc 3.4.0.\nThis extends the check for gcc so that use of __builtin_ctzll is only\nenabled if gcc >= 3.4.0.\n\nSigned-off-by: Tom G. Christensen <tgc@statsbiblioteket.dk>\n---\nv2:\nAdd S-o-b\n\nv1:\nI noticed this on RHEL3 during 2.0.0rc phase but I see that the same\nissue was noticed on Debian Sarge:\nhttp://article.gmane.org/gmane.comp.version-control.git/255190\nRHEL3 ships with gcc 3.2.3.\n\nWith this patch git can build on RHEL3 provided cURL support is disabled.\n\n ewah/ewok.h | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/ewah/ewok.h b/ewah/ewok.h\nindex f6ad190..13c6e20 100644\n--- a/ewah/ewok.h\n+++ b/ewah/ewok.h\n@@ -47,7 +47,8 @@ static inline uint32_t ewah_bit_popcount64(uint64_t x)\n \treturn (x * 0x0101010101010101ULL) >> 56;\n }\n \n-#ifdef __GNUC__\n+/* __builtin_ctzll was not available until 3.4.0 */\n+#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3  && __GNUC_MINOR > 3))\n #define ewah_bit_ctz64(x) __builtin_ctzll(x)\n #else\n static inline int ewah_bit_ctz64(uint64_t x)\n-- \n2.2.2\n"}]}