summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvestre Ledru <sylvestre@debian.org>2013-12-19 10:18:31 +0000
committerSylvestre Ledru <sylvestre@debian.org>2013-12-19 10:18:31 +0000
commit90b974428bfd8bcdb2cf38d6472d245bd4917e30 (patch)
tree581d2f8bad4d2dc43761850e5703f6f55bcfdf99
parent9a5d6bb0c26215adddc5ce00f21d863160cbd0b7 (diff)
downloadclang-90b974428bfd8bcdb2cf38d6472d245bd4917e30.tar.gz
clang-90b974428bfd8bcdb2cf38d6472d245bd4917e30.tar.bz2
clang-90b974428bfd8bcdb2cf38d6472d245bd4917e30.tar.xz
Update of the release notes to provide examples of the new checks/warnings
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_34@197667 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--docs/ReleaseNotes.rst59
1 files changed, 59 insertions, 0 deletions
diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst
index 877fcffbc4..ac0831fe40 100644
--- a/docs/ReleaseNotes.rst
+++ b/docs/ReleaseNotes.rst
@@ -64,15 +64,74 @@ about them. The improvements since the 3.3 release include:
- -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: