Skip to content

Commit 0ce2c64

Browse files
committed
Fix performance issue in EXP37-C
1 parent a4ebed2 commit 0ce2c64

3 files changed

Lines changed: 5 additions & 8 deletions

File tree

c/cert/src/rules/EXP37-C/DoNotCallFunctionsWithIncompatibleArguments.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,4 @@ where
2929
complexArgumentPassedToRealParameter(fc, f, p)
3030
)
3131
select fc,
32-
"Argument $@ in call to " + f.toString() + " is incompatible with parameter " + p.getTypedName() +
33-
".", fc.getArgument(p.getIndex()) as arg, arg.toString()
32+
"Argument $@ in call to " + f.toString() + " is incompatible with the function parameter type.", fc.getArgument(p.getIndex()) as arg, arg.toString()
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
| test.c:83:12:83:16 | call to atan2 | Argument $@ in call to atan2 is incompatible with parameter double (unnamed parameter 0). | test.c:83:18:83:18 | c | c |
2-
| test.c:93:3:93:12 | call to test_func1 | Argument $@ in call to test_func1 is incompatible with parameter short p1. | test.c:93:14:93:15 | p1 | p1 |
3-
| test.c:94:3:94:12 | call to test_func1 | Argument $@ in call to test_func1 is incompatible with parameter short p1. | test.c:94:14:94:15 | p2 | p2 |
1+
| test.c:83:12:83:16 | call to atan2 | Argument $@ in call to atan2 is incompatible with the function parameter type. | test.c:83:18:83:18 | c | c |
2+
| test.c:93:3:93:12 | call to test_func1 | Argument $@ in call to test_func1 is incompatible with the function parameter type. | test.c:93:14:93:15 | p1 | p1 |
3+
| test.c:94:3:94:12 | call to test_func1 | Argument $@ in call to test_func1 is incompatible with the function parameter type. | test.c:94:14:94:15 | p2 | p2 |

cpp/common/src/codingstandards/cpp/MistypedFunctionArguments.qll

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ private predicate hasZeroParamDecl(Function f) {
8282

8383
// True if this file (or header) was compiled as a C file
8484
private predicate isCompiledAsC(File f) {
85-
f.compiledAsC()
86-
or
87-
exists(File src | isCompiledAsC(src) | src.getAnIncludedFile() = f)
85+
exists(File src | src.compiledAsC() | src.getAnIncludedFile*() = f)
8886
}
8987

9088
private predicate isTypeInComplexDomain(FloatingPointType type) {

0 commit comments

Comments
 (0)