Bug 195657 - Fix audio/liblo build with clang 3.5.0
Summary: Fix audio/liblo build with clang 3.5.0
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks: 195480
  Show dependency treegraph
 
Reported: 2014-12-03 22:12 UTC by Dimitry Andric
Modified: 2014-12-04 20:48 UTC (History)
2 users (show)

See Also:
antoine: maintainer-feedback+


Attachments
Fix audio/liblo build with clang 3.5.0 (1.15 KB, patch)
2014-12-03 22:12 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2014-12-03 22:12:59 UTC
Created attachment 150155 [details]
Fix audio/liblo build with clang 3.5.0

On 64-bit arches, audio/liblo will fail to compile with clang 3.5.0, due to the following -Werror warning:

message.c:1000:17: error: absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value]
                abs((char *) d - (char *) end), m);
                ^

On 64-bit arches, pointer differences are usually longs, but simply replacing the abs() call with labs() is also not a good solution, because then the code is incorrect for 32-bit arches.

Fix this by using a ternary operator expression, which is type-safe.  While here, fix the printf format conversion specifier for printing ptrdiff_t's.
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2014-12-03 22:12:59 UTC
Maintainer CC'd
Comment 2 Antoine Brodin freebsd_committer freebsd_triage 2014-12-03 22:48:12 UTC
Approved by portmgr (antoine)
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2014-12-03 23:07:30 UTC
Fixed by r373852.