[Bug 196166] New: Fix net/mrouted build with clang 3.5.0

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Dec 20 19:37:31 UTC 2014


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196166

            Bug ID: 196166
           Summary: Fix net/mrouted build with clang 3.5.0
           Product: Ports Tree
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Individual Port(s)
          Assignee: hrs at FreeBSD.org
          Reporter: dim at FreeBSD.org
             Flags: maintainer-feedback?(hrs at FreeBSD.org)
          Assignee: hrs at FreeBSD.org

Created attachment 150819
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=150819&action=edit
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 from Bugzilla Automation <bugzilla at FreeBSD.org> ---
Auto-assigned to maintainer hrs at FreeBSD.org

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


More information about the freebsd-ports-bugs mailing list