Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Dec 2014 16:55:06 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 196135] New: Fix graphics/ImageMagick installed headers, and some other clang 3.5.0 warnings
Message-ID:  <bug-196135-13@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196135

            Bug ID: 196135
           Summary: Fix graphics/ImageMagick installed headers, and some
                    other clang 3.5.0 warnings
           Product: Ports Tree
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Individual Port(s)
          Assignee: kwm@FreeBSD.org
          Reporter: dim@FreeBSD.org
          Assignee: kwm@FreeBSD.org
             Flags: maintainer-feedback?(kwm@FreeBSD.org)

Created attachment 150782
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=150782&action=edit
Fix several clang 3.5.0 warnings in graphics/ImageMagick

In bug 195480, which is about fixing as many ports as possible for the clang
3.5.0 import, there are some newly reported port failures, which are caused by
ImageMagick headers [1].  In case of graphics/dcraw-m, this results in -Werror
warnings:

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)))
                                               ^

This is because the ImageMagick headers erroneously assume that clang supports
the __alloc_size__ attribute.  See also the upstream commit [2] which
introduced this error.

The fix for this is to define the magic_alloc_size, magic_alloc_sizes,
wand_alloc_size and wand_alloc_sizes macros as empty, when clang is used.

Additionally, since clang does support the __hot__ and __cold__ attributes,
these can be split off to a separate #ifdef block.

Another cause of many warnings is the sloppy usage of fabs(), even for float or
long double type, resulting in hundreds of warnings like:

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) &&
       ^~~~
       fabsl

ImageMagick should really define a magick_fabs() macro for this, and do a
global search and replace, but for our port that results in a diff that is very
big, and fragile to apply.

Therefore, fix this by #define'ing fabs as the correct function to call for
each particular MagickRealType (e.g. float, double or long double).

It would be nice if these changes go upstream.

[1]
http://pb2.nyi.freebsd.org/data/head-amd64-PR195480-default/2014-12-12_23h17m02s/logs/errors/dcraw-m-9.22.log
[2] http://trac.imagemagick.org/changeset/14360

--- Comment #1 from Bugzilla Automation <bugzilla@FreeBSD.org> ---
Auto-assigned to maintainer kwm@FreeBSD.org

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-196135-13>