diff options
author | dim <dim@FreeBSD.org> | 2014-11-23 18:31:55 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2014-11-23 18:31:55 +0000 |
commit | 32768fdf228b10cfe9d454a5c9f96340c00c8269 (patch) | |
tree | 631dd25608c1be79f72ea2c61385d60a3be32456 /contrib/llvm/tools/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp | |
parent | c9ca7e675137304db25e1277aa1b7d3481aa5c15 (diff) | |
download | FreeBSD-src-32768fdf228b10cfe9d454a5c9f96340c00c8269.zip FreeBSD-src-32768fdf228b10cfe9d454a5c9f96340c00c8269.tar.gz |
Fix the following -Werror warning from clang 3.5.0, while building the
ath kernel module:
sys/dev/ath/ath_hal/ar5212/ar5212_reset.c:2642:7: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
if (abs(lp[0] * EEP_SCALE - target) < EEP_DELTA) {
^
sys/dev/ath/ah_osdep.h:74:18: note: expanded from macro 'abs'
#define abs(_a) __builtin_abs(_a)
^
sys/dev/ath/ath_hal/ar5212/ar5212_reset.c:2642:7: note: remove the call to '__builtin_abs' since unsigned values cannot be negative
sys/dev/ath/ah_osdep.h:74:18: note: expanded from macro 'abs'
#define abs(_a) __builtin_abs(_a)
^
1 error generated.
This warning occurs because both lp[0] and target are unsigned, 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: adrian
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D1212
Diffstat (limited to 'contrib/llvm/tools/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp')
0 files changed, 0 insertions, 0 deletions