Author: sylvestre
Date: Thu Aug 14 11:09:45 2014
New Revision: 215651
URL: http://llvm.org/viewvc/llvm-project?rev=215651&view=rev
Log:
Document -Wtautological-pointer-compare & -Wtautological-undefined-compare 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=215651&r1=215650&r2=215651&view=diff
==============================================================================
--- cfe/branches/release_35/docs/ReleaseNotes.rst (original)
+++ cfe/branches/release_35/docs/ReleaseNotes.rst Thu Aug 14 11:09:45 2014
@@ -70,6 +70,38 @@ 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).
+- New warning `-Wtautological-pointer-compare`:
+
+ .. code-block:: c++
+
+ #include <stddef.h>
+ void foo() {
+ int arr[5];
+ int x;
+ // warn on these conditionals
+ if (foo);
+ if (arr);
+ if (&x);
+ if (foo == NULL);
+ if (arr == NULL);
+ if (&x == NULL);
+ }
+
+ returns
+ `warning: comparison of address of 'x' equal to a null pointer is always
false [-Wtautological-pointer-compare]`
+
+- New warning `-Wtautological-undefined-compare`:
+
+ .. code-block:: c++
+
+ #include <stddef.h>
+ void f(int &x) {
+ if (&x == nullptr) { }
+ }
+
+ returns
+ `warning: reference cannot be bound to dereferenced null pointer in
well-defined C++ code; comparison may be assumed to always evaluate to false
[-Wtautological-undefined-compare]`
+
- ...
New Compiler Flags
_______________________________________________
llvm-branch-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-branch-commits