[llvm-branch-commits] [cfe-branch] r197667 - Update of the release notes to provide examples of the new checks/warnings
Sylvestre Ledru
sylvestre at debian.org
Thu Dec 19 02:18:32 PST 2013
Author: sylvestre
Date: Thu Dec 19 04:18:31 2013
New Revision: 197667
URL: http://llvm.org/viewvc/llvm-project?rev=197667&view=rev
Log:
Update of the release notes to provide examples of the new checks/warnings
Modified:
cfe/branches/release_34/docs/ReleaseNotes.rst
Modified: cfe/branches/release_34/docs/ReleaseNotes.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/docs/ReleaseNotes.rst?rev=197667&r1=197666&r2=197667&view=diff
==============================================================================
--- cfe/branches/release_34/docs/ReleaseNotes.rst (original)
+++ cfe/branches/release_34/docs/ReleaseNotes.rst Thu Dec 19 04:18:31 2013
@@ -64,15 +64,74 @@ about them. The improvements since the 3
- -Wheader-guard warns on mismatches between the #ifndef and #define lines
in a header guard.
+
+ .. code-block:: c
+
+ #ifndef multiple
+ #define multi
+ #endif
+
+ returns
+ `warning: 'multiple' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]`
+
- -Wlogical-not-parentheses warns when a logical not ('!') only applies to the
left-hand side of a comparison. This warning is part of -Wparentheses.
+
+ .. code-block:: c++
+
+ int i1 = 0, i2 = 1;
+ bool ret;
+ ret = !i1 == i2;
+
+ returns
+ `warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses]`
+
+
- Boolean increment, a deprecated feature, has own warning flag
-Wdeprecated-increment-bool, and is still part of -Wdeprecated.
- Clang errors on builtin enum increments and decrements.
+
+ .. code-block:: c++
+
+ enum A { A1, A2 };
+ void test() {
+ A a;
+ a++;
+ }
+
+ returns
+ `error: must use 'enum' tag to refer to type 'A'`
+
+
- -Wloop-analysis now warns on for-loops which have the same increment or
decrement in the loop header as the last statement in the loop.
+
+ .. code-block:: c
+
+ void foo(char *a, char *b, unsigned c) {
+ for (unsigned i = 0; i < c; ++i) {
+ a[i] = b[i];
+ ++i;
+ }
+ }
+
+ returns
+ `warning: variable 'i' is incremented both in the loop header and in the loop body [-Wloop-analysis]`
+
- -Wuninitialized now performs checking across field initializers to detect
when one field in used uninitialized in another field initialization.
+
+ .. code-block:: c++
+
+ class A {
+ int x;
+ int y;
+ A() : x(y) {}
+ };
+
+ returns
+ `warning: field 'y' is uninitialized when used here [-Wuninitialized]`
+
- Clang can detect initializer list use inside a macro and suggest parentheses
if possible to fix.
- Many improvements to Clang's typo correction facilities, such as:
More information about the llvm-branch-commits
mailing list