diff options
Diffstat (limited to 'www/analyzer/alpha_checks.html')
-rw-r--r-- | www/analyzer/alpha_checks.html | 137 |
1 files changed, 23 insertions, 114 deletions
diff --git a/www/analyzer/alpha_checks.html b/www/analyzer/alpha_checks.html index beab87b6b3..d406b2c755 100644 --- a/www/analyzer/alpha_checks.html +++ b/www/analyzer/alpha_checks.html @@ -33,6 +33,7 @@ Patches welcome! <li><a href="#osx_alpha_checkers">OS X Alpha Checkers</a></li> <li><a href="#security_alpha_checkers">Security Alpha Checkers</a></li> <li><a href="#unix_alpha_checkers">Unix Alpha Checkers</a></li> +<li><a href="#nondeterminism_alpha_checkers">Non-determinism Alpha Checkers</a></li> </ul> <!-- ============================= clone alpha ============================= --> @@ -444,120 +445,6 @@ void f() { </pre></div></div></td></tr> -<tr><td><a id="alpha.cplusplus.UninitializedObject"><div class="namedescr expandable"><span class="name"> -alpha.cplusplus.UninitializedObject</span><span class="lang"> -(C++)</span><div class="descr"> -This checker reports uninitialized fields in objects created after a constructor -call. It doesn't only find direct uninitialized fields, but rather makes a deep -inspection of the object, analyzing all of it's fields subfields. <br> -The checker regards inherited fields as direct fields, so one will recieve -warnings for uninitialized inherited data members as well. <br> -<br> -It has several options: -<ul> - <li> - "<code>Pedantic</code>" (boolean). If its not set or is set to false, the - checker won't emit warnings for objects that don't have at least one - initialized field. This may be set with <br> - <code>-analyzer-config alpha.cplusplus.UninitializedObject:Pedantic=true</code>. - </li> - <li> - "<code>NotesAsWarnings</code>" (boolean). If set to true, the checker will - emit a warning for each uninitalized field, as opposed to emitting one - warning per constructor call, and listing the uninitialized fields that - belongs to it in notes. Defaults to false. <br> - <code>-analyzer-config alpha.cplusplus.UninitializedObject:NotesAsWarnings=true</code>. - </li> - <li> - "<code>CheckPointeeInitialization</code>" (boolean). If set to false, the - checker will not analyze the pointee of pointer/reference fields, and will - only check whether the object itself is initialized. Defaults to false. <br> - <code>-analyzer-config alpha.cplusplus.UninitializedObject:CheckPointeeInitialization=true</code>. - </li> - <li> - "<code>IgnoreRecordsWithField</code>" (string). If supplied, the checker - will not analyze structures that have a field with a name or type name that - matches the given pattern. Defaults to <code>""</code>. - - <code>-analyzer-config alpha.cplusplus.UninitializedObject:IgnoreRecordsWithField="[Tt]ag|[Kk]ind"</code>. - </li> -</ul></div></div></a></td> -<td><div class="exampleContainer expandable"> -<div class="example"><pre> -// With Pedantic and CheckPointeeInitialization set to true - -struct A { - struct B { - int x; // note: uninitialized field 'this->b.x' - // note: uninitialized field 'this->bptr->x' - int y; // note: uninitialized field 'this->b.y' - // note: uninitialized field 'this->bptr->y' - }; - int *iptr; // note: uninitialized pointer 'this->iptr' - B b; - B *bptr; - char *cptr; // note: uninitialized pointee 'this->cptr' - - A (B *bptr, char *cptr) : bptr(bptr), cptr(cptr) {} -}; - -void f() { - A::B b; - char c; - A a(&b, &c); // warning: 6 uninitialized fields - // after the constructor call -} -</pre></div><div class="separator"></div> -<div class="example"><pre> -// With Pedantic set to false and -// CheckPointeeInitialization set to true -// (every field is uninitialized) - -struct A { - struct B { - int x; - int y; - }; - int *iptr; - B b; - B *bptr; - char *cptr; - - A (B *bptr, char *cptr) : bptr(bptr), cptr(cptr) {} -}; - -void f() { - A::B b; - char c; - A a(&b, &c); // no warning -} -</pre></div><div class="separator"></div> -<div class="example"><pre> -// With Pedantic and CheckPointeeInitialization set to false -// (pointees are regarded as initialized) - -struct A { - struct B { - int x; // note: uninitialized field 'this->b.x' - int y; // note: uninitialized field 'this->b.y' - }; - int *iptr; // note: uninitialized pointer 'this->iptr' - B b; - B *bptr; - char *cptr; - - A (B *bptr, char *cptr) : bptr(bptr), cptr(cptr) {} -}; - -void f() { - A::B b; - char c; - A a(&b, &c); // warning: 3 uninitialized fields - // after the constructor call -} -</pre></div></div></td></tr> - - </tbody></table> @@ -1174,6 +1061,28 @@ void test(char *y) { </tbody></table> +<!-- =========================== nondeterminism alpha =========================== --> +<h3 id="nondeterminism_alpha_checkers">Non-determinism Alpha Checkers</h3> +<table class="checkers"> +<colgroup><col class="namedescr"><col class="example"></colgroup> +<thead><tr><td>Name, Description</td><td>Example</td></tr></thead> + +<tbody> +<tr><td><a id="alpha.nondeterminism.PointerSorting"><div class="namedescr expandable"><span class="name"> +alpha.nondeterminism.PointerSorting</span><span class="lang"> +(C++)</span><div class="descr"> +Check for non-determinism caused by sorting of pointers.</div></div></a></td> +<td><div class="exampleContainer expandable"> +<div class="example"><pre> +// C++ +void test() { + int a = 1, b = 2; + std::vector<int *> V = {&a, &b}; + std::sort(V.begin(), V.end()); // warn +} +</pre></div></div></td></tr> +</tbody></table> + </div> <!-- page --> </div> <!-- content --> </body> |