10bfcc72ff
Fix the following -Werror warnings from clang 3.5.0, while building usr.sbin/rtadvd: usr.sbin/rtadvd/rtadvd.c:1291:7: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value] abs(preferred_time - pfx->pfx_pltimeexpire) > rai->rai_clockskew) { ^ usr.sbin/rtadvd/rtadvd.c:1291:7: note: remove the call to 'abs' since unsigned values cannot be negative abs(preferred_time - pfx->pfx_pltimeexpire) > rai->rai_clockskew) { ^~~ usr.sbin/rtadvd/rtadvd.c:1324:7: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value] abs(valid_time - pfx->pfx_vltimeexpire) > rai->rai_clockskew) { ^ usr.sbin/rtadvd/rtadvd.c:1324:7: note: remove the call to 'abs' since unsigned values cannot be negative abs(valid_time - pfx->pfx_vltimeexpire) > rai->rai_clockskew) { ^~~ 2 errors generated. These warnings occur because both preferred_time and pfx_pltimeexpire are uint32_t's, so the subtraction expression is also unsigned, and calling abs() is a no-op. However, the intention was to look at the absolute difference between the two unsigned quantities. Introduce a small static function to clarify what we're doing, and call that instead. Reviewed by: hrs Differential Revision: https://reviews.freebsd.org/D1197 |
||
---|---|---|
.. | ||
advcap.c | ||
advcap.h | ||
config.c | ||
config.h | ||
control_client.c | ||
control_client.h | ||
control_server.c | ||
control_server.h | ||
control.c | ||
control.h | ||
if.c | ||
if.h | ||
Makefile | ||
pathnames.h | ||
rrenum.c | ||
rrenum.h | ||
rtadvd.8 | ||
rtadvd.c | ||
rtadvd.conf | ||
rtadvd.conf.5 | ||
rtadvd.h | ||
timer_subr.c | ||
timer_subr.h | ||
timer.c | ||
timer.h |