File tree Expand file tree Collapse file tree
cpp/ql/test/query-tests/jsf
4.10 Classes/AV Rule 71.1
4.24 Control Flow Structures/AV Rule 197 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11class Base {
22public:
33 Base () {
4- init (); // $ Alert // BAD: virtual call, overridden in Derived
5- this ->init (); // $ Alert // BAD: virtual call, overridden in Derived
6- (*this ).init (); // $ Alert // BAD: virtual call, overridden in Derived
7- helper (); // $ Alert // BAD: indirectly calls a virtual function
4+ init (); // $ Alert
5+ this ->init (); // $ Alert
6+ (*this ).init (); // $ Alert
7+ helper (); // $ Alert ( indirectly calls a virtual function)
88 Base::init (); // GOOD: explicitly qualified, so statically bound
99 notOverridden (); // GOOD: not overridden in any derived class
1010 nonVirtual (); // GOOD: not virtual
1111 }
1212
1313 ~Base () {
14- cleanup (); // $ Alert // BAD: virtual call, overridden in Derived
14+ cleanup (); // $ Alert
1515 Base::cleanup (); // GOOD: explicitly qualified
1616 }
1717
Original file line number Diff line number Diff line change @@ -2,17 +2,17 @@ void use(double);
22
33void test ()
44{
5- for (float f = 0 .0f ; f < 1 .0f ; f = f + 0 .1f ) // $ Alert // BAD: float loop counter
5+ for (float f = 0 .0f ; f < 1 .0f ; f = f + 0 .1f ) // $ Alert
66 {
77 use (f);
88 }
99
10- for (double d = 0.0 ; d < 10.0 ; d++) // $ Alert // BAD: double loop counter
10+ for (double d = 0.0 ; d < 10.0 ; d++) // $ Alert
1111 {
1212 use (d);
1313 }
1414
15- long double ld; // $ Alert // BAD: long double loop counter
15+ long double ld; // $ Alert
1616 for (ld = 10.0 ; ld > 0.0 ; ld--)
1717 {
1818 use (ld);
@@ -39,7 +39,7 @@ typedef float real;
3939
4040void test_typedef ()
4141{
42- for (real r = 0 .0f ; r < 1 .0f ; r = r + 0 .5f ) // $ Alert // BAD: float loop counter via typedef
42+ for (real r = 0 .0f ; r < 1 .0f ; r = r + 0 .5f ) // $ Alert
4343 {
4444 use (r);
4545 }
You can’t perform that action at this time.
0 commit comments