Bug 196166 - Fix net/mrouted build with clang 3.5.0
Summary: Fix net/mrouted 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: Hiroki Sato
URL:
Keywords:
Depends on:
Blocks: 195480
  Show dependency treegraph
 
Reported: 2014-12-20 19:37 UTC by Dimitry Andric
Modified: 2015-03-02 10:51 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (hrs)


Attachments
Fix net/mrouted build with clang 3.5.0 (1.34 KB, patch)
2014-12-20 19:37 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-20 19:37:30 UTC
Created attachment 150819 [details]
Fix net/mrouted build with clang 3.5.0

The net/mrouted port fails to compile with clang 3.5.0, due to the following -Werror warning:

mtrace.c:923:12: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
        if (*s || abs(ntohl(n->tr_vifout) - ntohl(p->tr_vifout)) > 100000) {
                  ^
mtrace.c:923:12: note: remove the call to 'abs' since unsigned values cannot be negative
        if (*s || abs(ntohl(n->tr_vifout) - ntohl(p->tr_vifout)) > 100000) {
                  ^~~
1 error generated.

This is a bug in the code, because the return value of ntohl() is unsigned, and the difference of two unsigned quantities is still unsigned.  However, the intent of the expression is to look at the absolute difference between the two quantities.

Therefore, similar to head r274898 [1] for rtadvd, introduce a small static function that clarifies the intent, and call it instead.

[1] https://svnweb.freebsd.org/base?view=revision&revision=274898
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2014-12-20 19:37:30 UTC
Auto-assigned to maintainer hrs@FreeBSD.org
Comment 2 Koop Mast freebsd_committer freebsd_triage 2015-02-23 00:14:27 UTC
Any progress on this? Else I would like to commit this after a week.
Comment 3 commit-hook freebsd_committer freebsd_triage 2015-03-02 10:50:51 UTC
A commit references this bug:

Author: kwm
Date: Mon Mar  2 10:50:15 UTC 2015
New revision: 380247
URL: https://svnweb.freebsd.org/changeset/ports/380247

Log:
  Fix the build with clang 3.5.

  PR:		196166
  Submitted by:	dim@
  Approved by:	maintainer (timeout 6 weeks)

Changes:
  head/net/mrouted/files/patch-mtrace.c