[CPP-340] Re-work QL query; treat undeclared C functions the same way as

()-declared functions.
This commit is contained in:
Ziemowit Laski
2019-03-19 14:30:05 -07:00
parent 5d8b84c22a
commit 2def0ee9c1
3 changed files with 13 additions and 13 deletions

View File

@@ -17,11 +17,11 @@ from FunctionCall fc, Function f
/* There must be a zero-parameter declaration */
and exists ( FunctionDeclarationEntry fde | fde = f.getADeclarationEntry() | fde.getNumberOfParameters() = 0)
/* There must be a mismatch between number of call arguments and number of parameters in some
* non-implicit declaration of Function f
* declaration of Function f
*/
and exists ( FunctionDeclarationEntry fde | fde = f.getADeclarationEntry() | not fde.isImplicit() and fde.getNumberOfParameters() != fc.getNumberOfArguments())
/* There must be no _definition_ of Function f whose number of parameters matches number of call arguments */
and not exists ( FunctionDeclarationEntry fde | fde = f.getADeclarationEntry() | fde.isDefinition() and fde.getNumberOfParameters() = fc.getNumberOfArguments())
select fc
and exists ( FunctionDeclarationEntry fde | fde = f.getADeclarationEntry() | fde.getNumberOfParameters() != fc.getNumberOfArguments())
/* There must be no actual declaration of Function f whose number of parameters matches number of call arguments */
and not exists ( FunctionDeclarationEntry fde | fde = f.getADeclarationEntry() | not fde.isImplicit() and fde.getNumberOfParameters() = fc.getNumberOfArguments())
select fc, "This call has arguments, but $@ is not declared with any parameters.", f, f.toString()