Page 1 of 1

ImageMagick and clang 3.5.0

Posted: 2014-12-20T13:18:13-07:00
by kwm

FreeBSD is currently moving to making clang 3.5.0 our default compiler. Which exposed three problems in the IM code (based on IM 6.9.0-0) [1].

The first problem is that IM assumes clang supports __alloc_size__() [2], which it does not. It does support __hot__ and __cold__. So the patch [3] fixes both these issues.

In file included from dcraw-m.c:53:
In file included from /usr/local/include/ImageMagick-6/wand/MagickWand.h:72:
In file included from /usr/local/include/ImageMagick-6/magick/MagickCore.h:120:
/usr/local/include/ImageMagick-6/magick/memory_.h:29:36: error: unknown attribute '__alloc_size__' ignored [-Werror,-Wunknown-attributes]
*(*AcquireMemoryHandler)(size_t) magick_alloc_size(1),
/usr/local/include/ImageMagick-6/magick/method-attribute.h:127:48: note: expanded from macro 'magick_alloc_size'
# define magick_alloc_size(x) __attribute__((__alloc_size__(x)))

The third problem is that IM uses fabs() sloppy. The bug report [1] mentions a hack that we can use as a temporaly patch for the FreeBSD port. Perhaps this can be a fixed in a beter way in the IM code by using a magick_fabs() function that calls fabs(), fabsl() or fabsf() depending on the content of MAGICKCORE_SIZEOF_FLOAT_T or MAGICKCORE_SIZEOF_DOUBLE_T? Not sure about how this should be fixed.

In file included from coders/tga.c:47:
./magick/color-private.h:44:8: warning: absolute value function 'fabs' given an argument of type 'long double' but has parameter of type 'double' which may cause truncation of value [-Wabsolute-value]
if ((fabs(red-q->red) < MagickEpsilon) &&
./magick/color-private.h:44:8: note: use function 'fabsl' instead
if ((fabs(red-q->red) < MagickEpsilon) &&



[1] Downstream bug: ... ?id=196135

Re: ImageMagick and clang 3.5.0

Posted: 2014-12-20T14:06:05-07:00
by magick
Thanks for the alerts and patches. Look for them in ImageMagick 6.9.0-1 Beta by sometime tomorrow.