Add -Wabsolute-value, warnings about absolute value functions.
The warnings fall into three groups.
- Using an absolute value function of the wrong type, for instance, using the
int absolute value function when the argument is a floating point type.
- Using the improper sized absolute value function, for instance, using abs
when the argument is a long long. llabs should be used instead.
From these two cases, an implicit conversion will occur which may cause
unexpected behavior. Where possible, suggest the proper absolute value
function to use, and which header to include if the function is not available.
- Taking the absolute value of an unsigned value. In addition to this warning,
suggest to remove the function call. This usually indicates a logic error
since the programmer assumed negative values would have been possible.