From bf19b4da725deff1f109478e4f577b54e09d08e7 Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Tue, 6 Aug 2013 13:03:22 +0100 Subject: [PATCH] MinGW-w64 build fix (lacks ffs declaration) Define ffs as __builtin_ffs if ffs is not declared but __builtin_ffs is declared. This problem only happens at -O0 as one of the optimization passes substitutes ffs for __builtin_ffs. Signed-off-by: Ray Donnelly Signed-off-by: Sven Verdoolaege --- configure.ac | 2 ++ isl_config_post.h | 4 ++++ isl_hash.c | 1 + 3 files changed, 7 insertions(+) diff --git a/configure.ac b/configure.ac index 8bfeded2..437146dd 100644 --- a/configure.ac +++ b/configure.ac @@ -104,6 +104,8 @@ if test $need_normalized_gcdext = true; then AC_DEFINE([GMP_NORMALIZE_GCDEXT], [], [result of mpz_gcdext needs to be normalized]) fi +AC_CHECK_DECLS(ffs,[],[],[#include ]) +AC_CHECK_DECLS(__builtin_ffs,[],[],[]) AX_SUBMODULE(piplib,no|system|build,no) diff --git a/isl_config_post.h b/isl_config_post.h index 86a094df..a9cdda34 100644 --- a/isl_config_post.h +++ b/isl_config_post.h @@ -1,3 +1,7 @@ #ifndef HAVE___ATTRIBUTE__ #define __attribute__(x) #endif + +#if (HAVE_DECL_FFS==0) && (HAVE_DECL___BUILTIN_FFS==1) +#define ffs __builtin_ffs +#endif diff --git a/isl_hash.c b/isl_hash.c index 7b96c51c..bd75a0d4 100644 --- a/isl_hash.c +++ b/isl_hash.c @@ -11,6 +11,7 @@ #include #include #include +#include "isl_config.h" uint32_t isl_hash_string(uint32_t hash, const char *s) { -- 2.11.4.GIT