[cairo-bugs] [Bug 30277] Compilation failure due to ffs() when compiling for MinGW

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Nov 1 15:34:24 PDT 2010


https://bugs.freedesktop.org/show_bug.cgi?id=30277

--- Comment #5 from Adrian Johnson <ajohnson at redneon.com> 2010-11-01 15:34:22 PDT ---
MingW provides a minimal environment for compiling with gcc and linking against
msvcrt. As ffs() is a POSIX function it is out of scope for MingW and won't be
added.

I think the best solution is to allow MingW to use the cairo version of ffs()
that is already used when compiling with VC. This would be better for debugging
that using the builtin and of course gcc will still use the builtin with -O2.

Here's an untested patch to implement this. Please test.

diff --git a/src/cairo-compiler-private.h b/src/cairo-compiler-private.h
index e25ee1f..4ce3339 100644
--- a/src/cairo-compiler-private.h
+++ b/src/cairo-compiler-private.h
@@ -212,7 +212,9 @@
 #ifdef _MSC_VER
 #undef inline
 #define inline __inline
+#endif

+#if defined(_MSC_VER) || defined(__MINGW32__)
 /* Add a definition of ffs */
 #include <intrin.h>
 #pragma intrinsic(_BitScanForward)

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the cairo-bugs mailing list