From: Stefan Behnel Date: Mon, 3 Sep 2007 14:17:12 +0000 (+0200) Subject: do not use __builtin_expect with GCC < 2.96 X-Git-Tag: 0.9.6.14~29^2~129^2~13 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ec95ee9eaa5b99cfebabfe20a41043d04417d5be;p=cython.git do not use __builtin_expect with GCC < 2.96 --- diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index c447968a..df61a8eb 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -2647,8 +2647,15 @@ if Options.gcc_branch_hints: branch_prediction_macros = \ """ #ifdef __GNUC__ +/* Test for GCC > 2.95 */ +#if __GNUC__ > 2 || \ + (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) +#else /* __GNUC__ > 2 ... */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ #define likely(x) (x) #define unlikely(x) (x)