From 326140e9173ee763960e4d27e8393f4faec183ce Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Mon, 18 Oct 2010 18:27:05 +0100 Subject: [PATCH] win32: Add a workaround for missing ffs on MinGW On Windows it seems that msvcrt does not define an ffs function. There is already a workaround for MSVC in cairo-compiler-private.h but this does not help when compiling with MinGW. This patch adds an extra check for when targetting Windows with GCC and makes it use __builtin_ffs. https://bugs.freedesktop.org/show_bug.cgi?id=30968 --- src/cairo-compiler-private.h | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/src/cairo-compiler-private.h b/src/cairo-compiler-private.h index e25ee1f..ad5ad05 100644 --- a/src/cairo-compiler-private.h +++ b/src/cairo-compiler-private.h @@ -229,6 +229,12 @@ ffs (int x) #endif +/* The MinGW headers don't define a ffs function so we can use the GCC + builtin instead */ +#if defined(__GNUC__) && defined(__WIN32__) +#define ffs __builtin_ffs +#endif /* __GNUC__ */ + #if defined(_MSC_VER) && defined(_M_IX86) /* When compiling with /Gy and /OPT:ICF identical functions will be folded in together. The CAIRO_ENSURE_UNIQUE macro ensures that a function is always unique and -- 1.7.3.16.g9464b