diff --git a/cpp/ql/src/Likely Bugs/Underspecified Functions/MistypedFunctionArguments.ql b/cpp/ql/src/Likely Bugs/Underspecified Functions/MistypedFunctionArguments.ql index 1142cc1a45b..e137e90c716 100644 --- a/cpp/ql/src/Likely Bugs/Underspecified Functions/MistypedFunctionArguments.ql +++ b/cpp/ql/src/Likely Bugs/Underspecified Functions/MistypedFunctionArguments.ql @@ -84,10 +84,10 @@ predicate hasZeroParamDecl(Function f) { } // True if this file (or header) was compiled as a C file -predicate isCompiledAsC(Function f) { - exists(File file | file.compiledAsC() | - file = f.getFile() or file.getAnIncludedFile+() = f.getFile() - ) +predicate isCompiledAsC(File f) { + f.compiledAsC() + or + exists(File src | isCompiledAsC(src) | src.getAnIncludedFile() = f) } from FunctionCall fc, Function f, Parameter p @@ -95,7 +95,7 @@ where f = fc.getTarget() and p = f.getAParameter() and hasZeroParamDecl(f) and - isCompiledAsC(f) and + isCompiledAsC(f.getFile()) and not f.isVarargs() and not f instanceof BuiltInFunction and p.getIndex() < fc.getNumberOfArguments() and diff --git a/cpp/ql/src/Likely Bugs/Underspecified Functions/TooFewArguments.ql b/cpp/ql/src/Likely Bugs/Underspecified Functions/TooFewArguments.ql index a3e78fe61c4..705c1ec4dc8 100644 --- a/cpp/ql/src/Likely Bugs/Underspecified Functions/TooFewArguments.ql +++ b/cpp/ql/src/Likely Bugs/Underspecified Functions/TooFewArguments.ql @@ -24,10 +24,10 @@ predicate hasZeroParamDecl(Function f) { } // True if this file (or header) was compiled as a C file -predicate isCompiledAsC(Function f) { - exists(File file | file.compiledAsC() | - file = f.getFile() or file.getAnIncludedFile+() = f.getFile() - ) +predicate isCompiledAsC(File f) { + f.compiledAsC() + or + exists(File src | isCompiledAsC(src) | src.getAnIncludedFile() = f) } from FunctionCall fc, Function f @@ -36,7 +36,7 @@ where not f.isVarargs() and not f instanceof BuiltInFunction and hasZeroParamDecl(f) and - isCompiledAsC(f) and + isCompiledAsC(f.getFile()) and // There is an explicit declaration of the function whose parameter count is larger // than the number of call arguments exists(FunctionDeclarationEntry fde | fde = f.getADeclarationEntry() | diff --git a/cpp/ql/src/Likely Bugs/Underspecified Functions/TooManyArguments.ql b/cpp/ql/src/Likely Bugs/Underspecified Functions/TooManyArguments.ql index b0bd7746c15..59368236bbd 100644 --- a/cpp/ql/src/Likely Bugs/Underspecified Functions/TooManyArguments.ql +++ b/cpp/ql/src/Likely Bugs/Underspecified Functions/TooManyArguments.ql @@ -25,10 +25,10 @@ predicate hasZeroParamDecl(Function f) { } // True if this file (or header) was compiled as a C file -predicate isCompiledAsC(Function f) { - exists(File file | file.compiledAsC() | - file = f.getFile() or file.getAnIncludedFile+() = f.getFile() - ) +predicate isCompiledAsC(File f) { + f.compiledAsC() + or + exists(File src | isCompiledAsC(src) | src.getAnIncludedFile() = f) } from FunctionCall fc, Function f @@ -36,7 +36,7 @@ where f = fc.getTarget() and not f.isVarargs() and hasZeroParamDecl(f) and - isCompiledAsC(f) and + isCompiledAsC(f.getFile()) and exists(f.getBlock()) and // There must not exist a declaration with the number of parameters // at least as large as the number of call arguments