Skip to content

Commit faf222e

Browse files
committed
Use new isPrototyped predicate in RULE-8-2
From CodeQL 2.15.4 onwards, parameters declared in a declaration list will have a location.
1 parent f0ffd4d commit faf222e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

c/misra/src/rules/RULE-8-2/FunctionTypesNotInPrototypeForm.ql

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,9 @@ where
4848
msg = "Function " + f + " does not specify void for no parameters present."
4949
or
5050
//parameters declared in declaration list (not in function signature)
51-
//have placeholder file location associated only
52-
exists(Parameter p |
53-
p.getFunction() = f and
54-
not p.getFile() = f.getFile() and
55-
msg = "Function " + f + " declares parameter in unsupported declaration list."
56-
)
51+
//have no prototype
52+
not f.isPrototyped() and
53+
not hasZeroParamDecl(f) and
54+
msg = "Function " + f + " declares parameter in unsupported declaration list."
5755
)
5856
select f, msg

0 commit comments

Comments
 (0)