git » libfiu » commit 5084cd7

preload/posix: Fix gcc version check

author Alberto Bertogli
2015-08-08 00:22:46 UTC
committer Alberto Bertogli
2015-08-08 00:22:46 UTC
parent 745f0f656181fface3a9394f3f8a9c7342e4cb7e

preload/posix: Fix gcc version check

The current gcc version check is wrong, and breaks with gcc 5.
This patch fixes this by using a more future-proof logic for version checking.

preload/posix/codegen.h +2 -2

diff --git a/preload/posix/codegen.h b/preload/posix/codegen.h
index 861cf2f..9e8cb3a 100644
--- a/preload/posix/codegen.h
+++ b/preload/posix/codegen.h
@@ -18,9 +18,9 @@ void *libc_symbol(const char *symbol);
  *  - GCC >= 4.3 on Linux
  *  - clang as of 2010-03-14
  */
+#define _GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__ * 10)
 #if \
-	( (defined __GNUC__) \
-		&& __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 ) \
+	( (defined __GNUC__) && _GCC_VERSION >= 4030 ) \
 	|| (defined __clang__)
   #define constructor_attr(prio) __attribute__((constructor(prio)))
 #else