summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/warn-absolute-value-header.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Consolidate header inclusion diagnosticsAlp Toker2014-07-111-4/+4
| | | | | | | Make argument orders match, unify diagnostic IDs and reword the message to be a little less saccharine. llvm-svn: 212845
* Make -Wabsolute-value C++-aware.Richard Trieu2014-04-151-24/+40
| | | | | | | | Warn on std::abs() with unsigned argument. Suggest std::abs as replacement for the C absolute value functions. Suggest C++ headers if the specific std::abs overload is not found. llvm-svn: 206340
* Add -Wabsolute-value, warnings about absolute value functions.Richard Trieu2014-02-261-0/+37
The warnings fall into three groups. 1) 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. 2) 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. 3) 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. llvm-svn: 202211
OpenPOWER on IntegriCloud