зеркало из https://github.com/microsoft/clang-1.git
Clang static analyzer docs: fix a couple of HTML markup issues and non-UTF-8
characters. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165364 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
9074fbe189
Коммит
b4e45295a8
|
@ -127,6 +127,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td><b>osx.coreFoundation.CFRetainRelease</b></td><td>Check for null arguments to CFRetain/CFRelease.</td>
|
<td><b>osx.coreFoundation.CFRetainRelease</b></td><td>Check for null arguments to CFRetain/CFRelease.</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
<td><b>osx.coreFoundation.containers.OutOfBounds</b></td><td>Checks for index out-of-bounds when using 'CFArray' API.</td>
|
<td><b>osx.coreFoundation.containers.OutOfBounds</b></td><td>Checks for index out-of-bounds when using 'CFArray' API.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<h1>List of potential checkers</h1>
|
<h1>List of potential checkers</h1>
|
||||||
|
|
||||||
<!---------------------------- allocation/deallocation -------------------------->
|
<!-- ========================= allocation/deallocation ======================= -->
|
||||||
<h3>allocation/deallocation</h3>
|
<h3>allocation/deallocation</h3>
|
||||||
<table class="checkers">
|
<table class="checkers">
|
||||||
<col class="namedescr"><col class="example"><col class="progress">
|
<col class="namedescr"><col class="example"><col class="progress">
|
||||||
|
@ -176,7 +176,7 @@ void test() {
|
||||||
<tr><td><span class="name">memory.NegativeArraySize
|
<tr><td><span class="name">memory.NegativeArraySize
|
||||||
<br>enhancement to experimental.security.MallocOverflow<br>(C, C++)
|
<br>enhancement to experimental.security.MallocOverflow<br>(C, C++)
|
||||||
</span><br><br>
|
</span><br><br>
|
||||||
‘n’ is used to specify the buffer size may be negative
|
'n' is used to specify the buffer size may be negative
|
||||||
</td><td><pre>
|
</td><td><pre>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ void test() {
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<!-------------------------- constructors/destructors ------------------------->
|
<!-- ======================= constructors/destructors ====================== -->
|
||||||
<h3>constructors/destructors</h3>
|
<h3>constructors/destructors</h3>
|
||||||
<table class="checkers">
|
<table class="checkers">
|
||||||
<col class="namedescr"><col class="example"><col class="progress">
|
<col class="namedescr"><col class="example"><col class="progress">
|
||||||
|
@ -223,7 +223,7 @@ class A {
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<!--------------------------------- exceptions -------------------------------->
|
<!-- ============================== exceptions ============================= -->
|
||||||
<h3>exceptions</h3>
|
<h3>exceptions</h3>
|
||||||
<table class="checkers">
|
<table class="checkers">
|
||||||
<col class="namedescr"><col class="example"><col class="progress">
|
<col class="namedescr"><col class="example"><col class="progress">
|
||||||
|
@ -260,7 +260,7 @@ void f() throw(int) {
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<!---------------------------- smart pointers --------------------------------->
|
<!-- ========================= smart pointers ============================== -->
|
||||||
<h3>smart pointers</h3>
|
<h3>smart pointers</h3>
|
||||||
<table class="checkers">
|
<table class="checkers">
|
||||||
<col class="namedescr"><col class="example"><col class="progress">
|
<col class="namedescr"><col class="example"><col class="progress">
|
||||||
|
@ -286,7 +286,7 @@ void test() {
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<!---------------------------- undefined behavior ----------------------------->
|
<!-- ========================= undefined behavior ========================== -->
|
||||||
<h3>undefined behavior</h3>
|
<h3>undefined behavior</h3>
|
||||||
<table class="checkers">
|
<table class="checkers">
|
||||||
<col class="namedescr"><col class="example"><col class="progress">
|
<col class="namedescr"><col class="example"><col class="progress">
|
||||||
|
@ -432,7 +432,7 @@ void test() {
|
||||||
B *b1 = new B;
|
B *b1 = new B;
|
||||||
B b2;
|
B b2;
|
||||||
new (b1) T;
|
new (b1) T;
|
||||||
new (&b2) T;
|
new (&b2) T;
|
||||||
delete b1; // warn
|
delete b1; // warn
|
||||||
} // warn
|
} // warn
|
||||||
</pre></td><td></td></tr>
|
</pre></td><td></td></tr>
|
||||||
|
@ -485,7 +485,7 @@ void test() {
|
||||||
*iq = 1; // warn
|
*iq = 1; // warn
|
||||||
|
|
||||||
const Y y;
|
const Y y;
|
||||||
Y* p = const_cast<Y*>(&y);
|
Y* p = const_cast<Y*>(&y);
|
||||||
p->x.i = 1; // ok
|
p->x.i = 1; // ok
|
||||||
p->x.j = 1; // warn
|
p->x.j = 1; // warn
|
||||||
}
|
}
|
||||||
|
@ -544,10 +544,10 @@ struct non_POD : public POD {
|
||||||
extern POD pod;
|
extern POD pod;
|
||||||
extern non_POD non_pod;
|
extern non_POD non_pod;
|
||||||
|
|
||||||
int *p1 = &non_pod.j; // warn
|
int *p1 = &non_pod.j; // warn
|
||||||
int *p2 = &non_pod.pod.i; // warn
|
int *p2 = &non_pod.pod.i; // warn
|
||||||
int *p3 = &pod.i; // ok
|
int *p3 = &pod.i; // ok
|
||||||
POD *p4 = & non_pod; // warn
|
POD *p4 = &non_pod; // warn
|
||||||
|
|
||||||
POD a;
|
POD a;
|
||||||
non_POD b;
|
non_POD b;
|
||||||
|
@ -555,7 +555,7 @@ non_POD b;
|
||||||
struct S {
|
struct S {
|
||||||
int *k;
|
int *k;
|
||||||
non_POD non_pod;
|
non_POD non_pod;
|
||||||
S() : k(&non_pod.j) {} // warn
|
S() : k(&non_pod.j) {} // warn
|
||||||
};
|
};
|
||||||
|
|
||||||
// C++11
|
// C++11
|
||||||
|
@ -572,10 +572,10 @@ struct non_trivial: public trivial {
|
||||||
extern trivial t;
|
extern trivial t;
|
||||||
extern non_trivial nt;
|
extern non_trivial nt;
|
||||||
|
|
||||||
int *p1 = &nt.j; // warn
|
int *p1 = &nt.j; // warn
|
||||||
int *p2 = &nt.i; // warn
|
int *p2 = &nt.i; // warn
|
||||||
int *p3 = &t.i; // ok
|
int *p3 = &t.i; // ok
|
||||||
trivial *p4 = &nt;
|
trivial *p4 = &nt;
|
||||||
|
|
||||||
trivial t;
|
trivial t;
|
||||||
non_trivial nt;
|
non_trivial nt;
|
||||||
|
@ -583,7 +583,7 @@ non_trivial nt;
|
||||||
struct S {
|
struct S {
|
||||||
int *k;
|
int *k;
|
||||||
non_trivial nt;
|
non_trivial nt;
|
||||||
S() : k(&nt.j) {} // warn
|
S() : k(&nt.j) {} // warn
|
||||||
};
|
};
|
||||||
</pre></td><td></td></tr>
|
</pre></td><td></td></tr>
|
||||||
|
|
||||||
|
@ -820,12 +820,12 @@ The effects are undefined if an exception is thrown.
|
||||||
</td><td><pre>
|
</td><td><pre>
|
||||||
struct S {
|
struct S {
|
||||||
int i, j;
|
int i, j;
|
||||||
S (const S &s) {
|
S (const S &s) {
|
||||||
i = s.i;
|
i = s.i;
|
||||||
throw 1; // warn
|
throw 1; // warn
|
||||||
j = s.j;
|
j = s.j;
|
||||||
};
|
};
|
||||||
S& operator=(const S &s) {
|
S &operator=(const S &s) {
|
||||||
i = s.i;
|
i = s.i;
|
||||||
throw 1; // warn
|
throw 1; // warn
|
||||||
j = s.j;
|
j = s.j;
|
||||||
|
@ -993,8 +993,8 @@ class my_streambuf : public std::streambuf {
|
||||||
|
|
||||||
void test() {
|
void test() {
|
||||||
std::filebuf fb;
|
std::filebuf fb;
|
||||||
std::istream in(&fb);
|
std::istream in(&fb);
|
||||||
std::ostream out(&fb);
|
std::ostream out(&fb);
|
||||||
std::filebuf::off_type pos(-1);
|
std::filebuf::off_type pos(-1);
|
||||||
in.seekg(pos); // warn
|
in.seekg(pos); // warn
|
||||||
out.seekp(-1); // warn
|
out.seekp(-1); // warn
|
||||||
|
@ -1002,7 +1002,7 @@ void test() {
|
||||||
</pre></td><td></td></tr>
|
</pre></td><td></td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<!------------------------------- different ----------------------------------->
|
<!-- ============================ different ================================ -->
|
||||||
<h3>different</h3>
|
<h3>different</h3>
|
||||||
<table class="checkers">
|
<table class="checkers">
|
||||||
<col class="namedescr"><col class="example"><col class="progress">
|
<col class="namedescr"><col class="example"><col class="progress">
|
||||||
|
@ -1175,8 +1175,8 @@ void test() {
|
||||||
|
|
||||||
<tr><td><span class="name">different.WrongVarForStmt
|
<tr><td><span class="name">different.WrongVarForStmt
|
||||||
<br>(C, C++)</span><br><br>
|
<br>(C, C++)</span><br><br>
|
||||||
Possibly wrong variable is used in the loop/cond-expression of the ‘for’
|
Possibly wrong variable is used in the loop/cond-expression of the 'for'
|
||||||
statement. Did you mean ‘proper_variable_name’?
|
statement. Did you mean 'proper_variable_name'?
|
||||||
</td><td><pre>
|
</td><td><pre>
|
||||||
void test() {
|
void test() {
|
||||||
int i;
|
int i;
|
||||||
|
@ -1213,21 +1213,21 @@ void test() {
|
||||||
|
|
||||||
<tr><td><span class="name">different.BitwiseOpBoolArg
|
<tr><td><span class="name">different.BitwiseOpBoolArg
|
||||||
<br>maybe join with experimental.core.BoolAssignment<br>(C, C++)</span><br><br>
|
<br>maybe join with experimental.core.BoolAssignment<br>(C, C++)</span><br><br>
|
||||||
bool value is used at the left/right part of the & (|) operator. Did you mean
|
bool value is used at the left/right part of the & (|) operator. Did you mean
|
||||||
&& (||) ?
|
&& (||) ?
|
||||||
</td><td><pre>
|
</td><td><pre>
|
||||||
int f();
|
int f();
|
||||||
|
|
||||||
void test() {
|
void test() {
|
||||||
bool b = true;
|
bool b = true;
|
||||||
if (b & f()) {} // warn
|
if (b & f()) {} // warn
|
||||||
}
|
}
|
||||||
</pre></td><td></td></tr>
|
</pre></td><td></td></tr>
|
||||||
|
|
||||||
<tr><td><span class="name">different.LabelInsideSwitch
|
<tr><td><span class="name">different.LabelInsideSwitch
|
||||||
<br>(C)</span><br><br>
|
<br>(C)</span><br><br>
|
||||||
Possible misprint: label found inside the switch() statement. (* did you mean
|
Possible misprint: label found inside the switch() statement. (* did you mean
|
||||||
‘default’?)
|
'default'?)
|
||||||
</td><td><pre>
|
</td><td><pre>
|
||||||
void test() {
|
void test() {
|
||||||
int c = 7;
|
int c = 7;
|
||||||
|
@ -1242,7 +1242,7 @@ void test() {
|
||||||
|
|
||||||
<tr><td><span class="name">different.IdenticalCondIfIf
|
<tr><td><span class="name">different.IdenticalCondIfIf
|
||||||
<br>(C)</span><br><br>
|
<br>(C)</span><br><br>
|
||||||
The conditions of two subsequent ‘if’ statements are identical
|
The conditions of two subsequent 'if' statements are identical
|
||||||
</td><td><pre>
|
</td><td><pre>
|
||||||
void test() {
|
void test() {
|
||||||
int c = 7;
|
int c = 7;
|
||||||
|
@ -1255,7 +1255,7 @@ void test() {
|
||||||
|
|
||||||
<tr><td><span class="name">different.CondOpIdenticalReturn
|
<tr><td><span class="name">different.CondOpIdenticalReturn
|
||||||
<br>(C)</span><br><br>
|
<br>(C)</span><br><br>
|
||||||
The return expressions of the ‘?:’ operator are identical
|
The return expressions of the '?:' operator are identical
|
||||||
</td><td><pre>
|
</td><td><pre>
|
||||||
void test() {
|
void test() {
|
||||||
unsigned a;
|
unsigned a;
|
||||||
|
@ -1265,7 +1265,7 @@ void test() {
|
||||||
|
|
||||||
<tr><td><span class="name">different.UnaryPlusWithUnsigned
|
<tr><td><span class="name">different.UnaryPlusWithUnsigned
|
||||||
<br>(C)</span><br><br>
|
<br>(C)</span><br><br>
|
||||||
Using ‘unary +’ with unsigned is meaningless
|
Using 'unary +' with unsigned is meaningless
|
||||||
</td><td><pre>
|
</td><td><pre>
|
||||||
void test() {
|
void test() {
|
||||||
unsigned a;
|
unsigned a;
|
||||||
|
@ -1275,11 +1275,11 @@ void test() {
|
||||||
|
|
||||||
<tr><td><span class="name">different.LogicalOpUselessArg
|
<tr><td><span class="name">different.LogicalOpUselessArg
|
||||||
<br>(C)</span><br><br>
|
<br>(C)</span><br><br>
|
||||||
The second operand of the && operator has no impact on expression result
|
The second operand of the && operator has no impact on expression result
|
||||||
</td><td><pre>
|
</td><td><pre>
|
||||||
void test() {
|
void test() {
|
||||||
unsigned a;
|
unsigned a;
|
||||||
if (a<7 && a<10) {}; // warn
|
if (a<7 && a<10) {}; // warn
|
||||||
}
|
}
|
||||||
</pre></td><td></td></tr>
|
</pre></td><td></td></tr>
|
||||||
|
|
||||||
|
@ -1290,14 +1290,14 @@ The expression always evaluates to true/false
|
||||||
void test() {
|
void test() {
|
||||||
int i=0;
|
int i=0;
|
||||||
if (i!=0) {}; // warn
|
if (i!=0) {}; // warn
|
||||||
if (i==0 && i==1) {}; // warn
|
if (i==0 && i==1) {}; // warn
|
||||||
if (i<0 || i>=0) {}; // warn
|
if (i<0 || i>=0) {}; // warn
|
||||||
}
|
}
|
||||||
</pre></td><td></td></tr>
|
</pre></td><td></td></tr>
|
||||||
|
|
||||||
<tr><td><span class="name">different.SameResUnsignedCmp
|
<tr><td><span class="name">different.SameResUnsignedCmp
|
||||||
<br>(C)</span><br><br>
|
<br>(C)</span><br><br>
|
||||||
Comparison of unsigned expression ‘op expr’ is always true/false
|
Comparison of unsigned expression 'op expr' is always true/false
|
||||||
</td><td><pre>
|
</td><td><pre>
|
||||||
void test() {
|
void test() {
|
||||||
unsigned u;
|
unsigned u;
|
||||||
|
@ -1309,7 +1309,7 @@ void test() {
|
||||||
<tr><td><span class="name">different.OpPrecedenceAssignCmp
|
<tr><td><span class="name">different.OpPrecedenceAssignCmp
|
||||||
<br>(C)</span><br><br>
|
<br>(C)</span><br><br>
|
||||||
Comparison operation has higher precedence then assignment. Bool value is
|
Comparison operation has higher precedence then assignment. Bool value is
|
||||||
assigned to variable of type ‘type’. Parenthesis may bee required around an
|
assigned to variable of type 'type'. Parenthesis may bee required around an
|
||||||
assignment
|
assignment
|
||||||
</td><td><pre>
|
</td><td><pre>
|
||||||
int f();
|
int f();
|
||||||
|
@ -1339,7 +1339,7 @@ void test() {
|
||||||
<br>(C++)</span><br><br>
|
<br>(C++)</span><br><br>
|
||||||
The object was created but is not being used<br><br>
|
The object was created but is not being used<br><br>
|
||||||
The exception object was created but is not being used. Did you mean
|
The exception object was created but is not being used. Did you mean
|
||||||
‘throw std::exception();’ ?
|
'throw std::exception();'?
|
||||||
</td><td><pre>
|
</td><td><pre>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
|
@ -1374,7 +1374,7 @@ void test() {
|
||||||
|
|
||||||
<tr><td><span class="name">different.ConversionToBool
|
<tr><td><span class="name">different.ConversionToBool
|
||||||
<br>maybe join with experimental.core.BoolAssignment<br>(C, C++)</span><br><br>
|
<br>maybe join with experimental.core.BoolAssignment<br>(C, C++)</span><br><br>
|
||||||
Odd implicit conversion from ‘type’ to ‘bool’
|
Odd implicit conversion from 'type' to 'bool'
|
||||||
</td><td><pre>
|
</td><td><pre>
|
||||||
bool test() {
|
bool test() {
|
||||||
return 1.; // warn
|
return 1.; // warn
|
||||||
|
@ -1488,7 +1488,7 @@ public:
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<!------------------------------- WinAPI -------------------------------------->
|
<!-- ============================ WinAPI =================================== -->
|
||||||
<h3>WinAPI</h3>
|
<h3>WinAPI</h3>
|
||||||
<table class="checkers">
|
<table class="checkers">
|
||||||
<col class="namedescr"><col class="example"><col class="progress">
|
<col class="namedescr"><col class="example"><col class="progress">
|
||||||
|
@ -1507,7 +1507,7 @@ void test() {
|
||||||
BOOL fSuccess;
|
BOOL fSuccess;
|
||||||
fSuccess = CreateProcess(
|
fSuccess = CreateProcess(
|
||||||
NULL, TEXT("MyProgram.exe"), NULL, NULL,
|
NULL, TEXT("MyProgram.exe"), NULL, NULL,
|
||||||
TRUE, 0, NULL, NULL, &si, &pi);
|
TRUE, 0, NULL, NULL, &si, &pi);
|
||||||
} // warn
|
} // warn
|
||||||
</pre></td><td></td></tr>
|
</pre></td><td></td></tr>
|
||||||
|
|
||||||
|
@ -1548,7 +1548,7 @@ void test()
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<!------------------------------ optimization --------------------------------->
|
<!-- =========================== optimization ============================== -->
|
||||||
<h3>optimization</h3>
|
<h3>optimization</h3>
|
||||||
<table class="checkers">
|
<table class="checkers">
|
||||||
<col class="namedescr"><col class="example"><col class="progress">
|
<col class="namedescr"><col class="example"><col class="progress">
|
||||||
|
@ -1593,14 +1593,14 @@ variable
|
||||||
|
|
||||||
void test() {
|
void test() {
|
||||||
const char* s = "abc";
|
const char* s = "abc";
|
||||||
if (strlen(s) > 0 &&
|
if (strlen(s) > 0 &&
|
||||||
strlen(s) < 7) {}; // warn
|
strlen(s) < 7) {}; // warn
|
||||||
}
|
}
|
||||||
</pre></td><td></td></tr>
|
</pre></td><td></td></tr>
|
||||||
|
|
||||||
<tr><td><span class="name">optimization.EmptyCstrDetect
|
<tr><td><span class="name">optimization.EmptyCstrDetect
|
||||||
<br>(C)</span><br><br>
|
<br>(C)</span><br><br>
|
||||||
Optimization: it is more efficient to use “str[0] != ‘\0’” to identify an empty
|
Optimization: it is more efficient to use "str[0] != '\0'" to identify an empty
|
||||||
string
|
string
|
||||||
</td><td><pre>
|
</td><td><pre>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче