Skip to content

Commit 8e2d449

Browse files
committed
Fix some violations of ql/counting-to-zero.
1 parent 55ba842 commit 8e2d449

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

cpp/ql/lib/semmle/code/cpp/valuenumbering/HashCons.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ private predicate mk_UuidofOperator(Type t, UuidofOperator e) {
648648
}
649649

650650
private predicate analyzableTypeidType(TypeidOperator e) {
651-
count(e.getAChild()) = 0 and
651+
not exists(e.getAChild()) and
652652
strictcount(e.getResultType()) = 1
653653
}
654654

cpp/ql/src/experimental/Likely Bugs/RedundantNullCheckParam.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ where
4747
// for a function parameter
4848
unchecked.getTarget() = param and
4949
// this function parameter is not overwritten
50-
count(param.getAnAssignment()) = 0 and
50+
not exists(param.getAnAssignment()) and
5151
check.getTarget() = param and
5252
// which is once checked
5353
candidateResultChecked(check, eqop) and

java/ql/lib/semmle/code/java/frameworks/javaee/ejb/EJB.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ class SessionEjb extends EJB {
3535
// Either the EJB does not declare any business interfaces explicitly
3636
// and implements a single interface candidate,
3737
// which is then considered to be the business interface...
38-
count(this.getAnExplicitBusinessInterface()) = 0 and
38+
not exists(this.getAnExplicitBusinessInterface()) and
3939
count(this.getAnImplementedBusinessInterfaceCandidate()) = 1 and
4040
result = this.getAnImplementedBusinessInterfaceCandidate()
4141
or
4242
// ...or each business interface needs to be declared explicitly.
4343
(
4444
count(this.getAnImplementedBusinessInterfaceCandidate()) != 1 or
45-
count(this.getAnExplicitBusinessInterface()) != 0
45+
exists(this.getAnExplicitBusinessInterface())
4646
) and
4747
result = this.getAnExplicitBusinessInterface()
4848
}

java/ql/src/Likely Bugs/Termination/SpinOnField.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ class Empty extends Stmt {
3333
class EmptyLoop extends Stmt {
3434
EmptyLoop() {
3535
exists(ForStmt stmt | stmt = this |
36-
count(stmt.getAnInit()) = 0 and
37-
count(stmt.getAnUpdate()) = 0 and
36+
not exists(stmt.getAnInit()) and
37+
not exists(stmt.getAnUpdate()) and
3838
stmt.getStmt() instanceof Empty
3939
)
4040
or

0 commit comments

Comments
 (0)