Index: www/analyzer/alpha_checks.html =================================================================== --- www/analyzer/alpha_checks.html +++ www/analyzer/alpha_checks.html @@ -323,6 +323,118 @@ }; +
+Pedantic
" (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 -analyzer-config alpha.cplusplus.UninitializedObject:Pedantic=true
.
+ NotesAsWarnings
" (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. -analyzer-config alpha.cplusplus.UninitializedObject:NotesAsWarnings=true
.
+ CheckPointeeInitialization
" (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. -analyzer-config alpha.cplusplus.UninitializedObject:CheckPointeeInitialization=true
.
+ +// 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 +} +
+// 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 +} +
+// 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 +} ++ + +