On Fri, Nov 5, 2021 at 9:34 AM Anders Roxell <anders.roxell@xxxxxxxxxx> wrote:
When building selftests/timers with clang, the compiler warn about the
function abs() see below:
posix_timers.c:69:6: warning: absolute value function 'abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value]
if (abs(diff - DELAY * USECS_PER_SEC) > USECS_PER_SEC / 2) {
^
posix_timers.c:69:6: note: use function 'llabs' instead
if (abs(diff - DELAY * USECS_PER_SEC) > USECS_PER_SEC / 2) {
^~~
llabs
The note indicates what to do, Rework to use the function 'llabs()'.
Signed-off-by: Anders Roxell <anders.roxell@xxxxxxxxxx>
Thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
I wonder why tools/testing/selftests/timers/adjtick.c redefines llabs
when it already includes stdlib.h, and how that doesn't result in some
kind of compiler diagnostic.