[llvm-branch-commits] [cfe-branch] r215652 - Document -Wabsolute-value with example
Sylvestre Ledru
sylvestre at debian.org
Thu Aug 14 09:10:10 PDT 2014
Author: sylvestre
Date: Thu Aug 14 11:10:10 2014
New Revision: 215652
URL: http://llvm.org/viewvc/llvm-project?rev=215652&view=rev
Log:
Document -Wabsolute-value with example
Modified:
cfe/branches/release_35/docs/ReleaseNotes.rst
Modified: cfe/branches/release_35/docs/ReleaseNotes.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_35/docs/ReleaseNotes.rst?rev=215652&r1=215651&r2=215652&view=diff
==============================================================================
--- cfe/branches/release_35/docs/ReleaseNotes.rst (original)
+++ cfe/branches/release_35/docs/ReleaseNotes.rst Thu Aug 14 11:10:10 2014
@@ -70,6 +70,30 @@ about them. The improvements since the 3
- New warning `-Wabsolute-value`: Clang warns about incorrect or useless usage
of the absolute functions (`abs`, `fabsf`, etc).
+ .. code-block:: c
+
+ #include <stdlib.h>
+ void foo() {
+ unsigned int i=0;
+ abs(i);
+ }
+
+ returns
+ `warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]`
+
+ or
+
+ .. code-block:: c
+
+ #include <stdlib.h>
+ void plop() {
+ long long i=0;
+ abs(i);
+ }
+
+ returns
+ `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] use function 'llabs' instead`
+
- New warning `-Wtautological-pointer-compare`:
.. code-block:: c++
More information about the llvm-branch-commits
mailing list