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
Auto-assigned to maintainer hrs@FreeBSD.org
Any progress on this? Else I would like to commit this after a week.
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